Type.registerNamespace('AjaxControlToolkit');AjaxControlToolkit.BehaviorBase = function(element) {
AjaxControlToolkit.BehaviorBase.initializeBase(this,[element]);this._clientStateFieldID = null;this._pageRequestManager = null;this._partialUpdateBeginRequestHandler = null;this._partialUpdateEndRequestHandler = null;}
AjaxControlToolkit.BehaviorBase.prototype = {
initialize : function() {
AjaxControlToolkit.BehaviorBase.callBaseMethod(this, 'initialize');},
dispose : function() {
AjaxControlToolkit.BehaviorBase.callBaseMethod(this, 'dispose');if (this._pageRequestManager) {
if (this._partialUpdateBeginRequestHandler) {
this._pageRequestManager.remove_beginRequest(this._partialUpdateBeginRequestHandler);this._partialUpdateBeginRequestHandler = null;}
if (this._partialUpdateEndRequestHandler) {
this._pageRequestManager.remove_endRequest(this._partialUpdateEndRequestHandler);this._partialUpdateEndRequestHandler = null;}
this._pageRequestManager = null;}
},
get_ClientStateFieldID : function() {
return this._clientStateFieldID;},
set_ClientStateFieldID : function(value) {
if (this._clientStateFieldID != value) {
this._clientStateFieldID = value;this.raisePropertyChanged('ClientStateFieldID');}
},
get_ClientState : function() {
if (this._clientStateFieldID) {
var input = document.getElementById(this._clientStateFieldID);if (input) {
return input.value;}
}
return null;},
set_ClientState : function(value) {
if (this._clientStateFieldID) {
var input = document.getElementById(this._clientStateFieldID);if (input) {
input.value = value;}
}
},
registerPartialUpdateEvents : function() {
if (Sys && Sys.WebForms && Sys.WebForms.PageRequestManager){
this._pageRequestManager = Sys.WebForms.PageRequestManager.getInstance();if (this._pageRequestManager) {
this._partialUpdateBeginRequestHandler = Function.createDelegate(this, this._partialUpdateBeginRequest);this._pageRequestManager.add_beginRequest(this._partialUpdateBeginRequestHandler);this._partialUpdateEndRequestHandler = Function.createDelegate(this, this._partialUpdateEndRequest);this._pageRequestManager.add_endRequest(this._partialUpdateEndRequestHandler);}
}
},
_partialUpdateBeginRequest : function(sender, beginRequestEventArgs) {
},
_partialUpdateEndRequest : function(sender, endRequestEventArgs) {
}
}
AjaxControlToolkit.BehaviorBase.registerClass('AjaxControlToolkit.BehaviorBase', Sys.UI.Behavior);AjaxControlToolkit.DynamicPopulateBehaviorBase = function(element) {
AjaxControlToolkit.DynamicPopulateBehaviorBase.initializeBase(this, [element]);this._DynamicControlID = null;this._DynamicContextKey = null;this._DynamicServicePath = null;this._DynamicServiceMethod = null;this._cacheDynamicResults = false;this._dynamicPopulateBehavior = null;this._populatingHandler = null;this._populatedHandler = null;}
AjaxControlToolkit.DynamicPopulateBehaviorBase.prototype = {
initialize : function() {
AjaxControlToolkit.DynamicPopulateBehaviorBase.callBaseMethod(this, 'initialize');this._populatingHandler = Function.createDelegate(this, this._onPopulating);this._populatedHandler = Function.createDelegate(this, this._onPopulated);},
dispose : function() {
if (this._populatedHandler) {
if (this._dynamicPopulateBehavior) {
this._dynamicPopulateBehavior.remove_populated(this._populatedHandler);}
this._populatedHandler = null;}
if (this._populatingHandler) {
if (this._dynamicPopulateBehavior) {
this._dynamicPopulateBehavior.remove_populating(this._populatingHandler);}
this._populatingHandler = null;}
if (this._dynamicPopulateBehavior) {
this._dynamicPopulateBehavior.dispose();this._dynamicPopulateBehavior = null;}
AjaxControlToolkit.DynamicPopulateBehaviorBase.callBaseMethod(this, 'dispose');},
populate : function(contextKeyOverride) {
if (this._dynamicPopulateBehavior && (this._dynamicPopulateBehavior.get_element() != $get(this._DynamicControlID))) {
this._dynamicPopulateBehavior.dispose();this._dynamicPopulateBehavior = null;}
if (!this._dynamicPopulateBehavior && this._DynamicControlID && this._DynamicServiceMethod) {
this._dynamicPopulateBehavior = $create(AjaxControlToolkit.DynamicPopulateBehavior,
{
"id" : this.get_id() + "_DynamicPopulateBehavior",
"ContextKey" : this._DynamicContextKey,
"ServicePath" : this._DynamicServicePath,
"ServiceMethod" : this._DynamicServiceMethod,
"cacheDynamicResults" : this._cacheDynamicResults
}, null, null, $get(this._DynamicControlID));this._dynamicPopulateBehavior.add_populating(this._populatingHandler);this._dynamicPopulateBehavior.add_populated(this._populatedHandler);}
if (this._dynamicPopulateBehavior) {
this._dynamicPopulateBehavior.populate(contextKeyOverride ? contextKeyOverride : this._DynamicContextKey);}
},
_onPopulating : function(sender, eventArgs) {
this.raisePopulating(eventArgs);},
_onPopulated : function(sender, eventArgs) {
this.raisePopulated(eventArgs);},
get_dynamicControlID : function() {
return this._DynamicControlID;},
get_DynamicControlID : this.get_dynamicControlID,
set_dynamicControlID : function(value) {
if (this._DynamicControlID != value) {
this._DynamicControlID = value;this.raisePropertyChanged('dynamicControlID');this.raisePropertyChanged('DynamicControlID');}
},
set_DynamicControlID : this.set_dynamicControlID,
get_dynamicContextKey : function() {
return this._DynamicContextKey;},
get_DynamicContextKey : this.get_dynamicContextKey,
set_dynamicContextKey : function(value) {
if (this._DynamicContextKey != value) {
this._DynamicContextKey = value;this.raisePropertyChanged('dynamicContextKey');this.raisePropertyChanged('DynamicContextKey');}
},
set_DynamicContextKey : this.set_dynamicContextKey,
get_dynamicServicePath : function() {
return this._DynamicServicePath;},
get_DynamicServicePath : this.get_dynamicServicePath,
set_dynamicServicePath : function(value) {
if (this._DynamicServicePath != value) {
this._DynamicServicePath = value;this.raisePropertyChanged('dynamicServicePath');this.raisePropertyChanged('DynamicServicePath');}
},
set_DynamicServicePath : this.set_dynamicServicePath,
get_dynamicServiceMethod : function() {
return this._DynamicServiceMethod;},
get_DynamicServiceMethod : this.get_dynamicServiceMethod,
set_dynamicServiceMethod : function(value) {
if (this._DynamicServiceMethod != value) {
this._DynamicServiceMethod = value;this.raisePropertyChanged('dynamicServiceMethod');this.raisePropertyChanged('DynamicServiceMethod');}
},
set_DynamicServiceMethod : this.set_dynamicServiceMethod,
get_cacheDynamicResults : function() {
return this._cacheDynamicResults;},
set_cacheDynamicResults : function(value) {
if (this._cacheDynamicResults != value) {
this._cacheDynamicResults = value;this.raisePropertyChanged('cacheDynamicResults');}
},
add_populated : function(handler) {
this.get_events().addHandler("populated", handler);},
remove_populated : function(handler) {
this.get_events().removeHandler("populated", handler);},
raisePopulated : function(arg) {
var handler = this.get_events().getHandler("populated");if (handler) handler(this, arg);},
add_populating : function(handler) {
this.get_events().addHandler('populating', handler);},
remove_populating : function(handler) {
this.get_events().removeHandler('populating', handler);},
raisePopulating : function(eventArgs) {
var handler = this.get_events().getHandler('populating');if (handler) {
handler(this, eventArgs);}
}
}
AjaxControlToolkit.DynamicPopulateBehaviorBase.registerClass('AjaxControlToolkit.DynamicPopulateBehaviorBase', AjaxControlToolkit.BehaviorBase);AjaxControlToolkit.ControlBase = function(element) {
AjaxControlToolkit.ControlBase.initializeBase(this, [element]);this._clientStateField = null;this._callbackTarget = null;this._onsubmit$delegate = Function.createDelegate(this, this._onsubmit);this._oncomplete$delegate = Function.createDelegate(this, this._oncomplete);this._onerror$delegate = Function.createDelegate(this, this._onerror);}
AjaxControlToolkit.ControlBase.prototype = {
initialize : function() {
AjaxControlToolkit.ControlBase.callBaseMethod(this, "initialize");if (this._clientStateField) {
this.loadClientState(this._clientStateField.value);}
if (typeof(Sys.WebForms)!=="undefined" && typeof(Sys.WebForms.PageRequestManager)!=="undefined") {
Array.add(Sys.WebForms.PageRequestManager.getInstance()._onSubmitStatements, this._onsubmit$delegate);} else {
$addHandler(document.forms[0], "submit", this._onsubmit$delegate);}
},
dispose : function() {
if (typeof(Sys.WebForms)!=="undefined" && typeof(Sys.WebForms.PageRequestManager)!=="undefined") {
Array.remove(Sys.WebForms.PageRequestManager.getInstance()._onSubmitStatements, this._onsubmit$delegate);} else {
$removeHandler(document.forms[0], "submit", this._onsubmit$delegate);}
AjaxControlToolkit.ControlBase.callBaseMethod(this, "dispose");},
findElement : function(id) {
return $get(this.get_id() + '_' + id.split(':').join('_'));},
get_clientStateField : function() {
return this._clientStateField;},
set_clientStateField : function(value) {
if (this.get_isInitialized()) throw Error.invalidOperation(AjaxControlToolkit.Resources.ExtenderBase_CannotSetClientStateField);if (this._clientStateField != value) {
this._clientStateField = value;this.raisePropertyChanged('clientStateField');}
},
loadClientState : function(value) {
},
saveClientState : function() {
return null;},
_invoke : function(name, args, cb) {
if (!this._callbackTarget) {
throw Error.invalidOperation(AjaxControlToolkit.Resources.ExtenderBase_ControlNotRegisteredForCallbacks);}
if (typeof(WebForm_DoCallback)==="undefined") {
throw Error.invalidOperation(AjaxControlToolkit.Resources.ExtenderBase_PageNotRegisteredForCallbacks);}
var ar = [];for (var i = 0;i < args.length;i++) 
ar[i] = args[i];var clientState = this.saveClientState();if (clientState != null && !String.isInstanceOfType(clientState)) {
throw Error.invalidOperation(AjaxControlToolkit.Resources.ExtenderBase_InvalidClientStateType);}
var payload = Sys.Serialization.JavaScriptSerializer.serialize({name:name,args:ar,state:this.saveClientState()});WebForm_DoCallback(this._callbackTarget, payload, this._oncomplete$delegate, cb, this._onerror$delegate, true);},
_oncomplete : function(result, context) {
result = Sys.Serialization.JavaScriptSerializer.deserialize(result);if (result.error) {
throw Error.create(result.error);}
this.loadClientState(result.state);context(result.result);},
_onerror : function(message, context) {
throw Error.create(message);},
_onsubmit : function() {
if (this._clientStateField) {
this._clientStateField.value = this.saveClientState();}
return true;} 
}
AjaxControlToolkit.ControlBase.registerClass("AjaxControlToolkit.ControlBase", Sys.UI.Control);
Type.registerNamespace('AjaxControlToolkit');
AjaxControlToolkit.Resources={
"PasswordStrength_InvalidWeightingRatios":"Strength Weighting ratios must have 4 elements",
"Animation_ChildrenNotAllowed":"AjaxControlToolkit.Animation.createAnimation cannot add child animations to type \"{0}\" that does not derive from AjaxControlToolkit.Animation.ParentAnimation",
"PasswordStrength_RemainingSymbols":"{0} symbol characters",
"ExtenderBase_CannotSetClientStateField":"clientStateField can only be set before initialization",
"RTE_PreviewHTML":"Preview HTML",
"RTE_JustifyCenter":"Justify Center",
"PasswordStrength_RemainingUpperCase":"{0} more upper case characters",
"Animation_TargetNotFound":"AjaxControlToolkit.Animation.Animation.set_animationTarget requires the ID of a Sys.UI.DomElement or Sys.UI.Control.  No element or control could be found corresponding to \"{0}\"",
"RTE_FontColor":"Font Color",
"RTE_LabelColor":"Label Color",
"Common_InvalidBorderWidthUnit":"A unit type of \"{0}\"\u0027 is invalid for parseBorderWidth",
"RTE_Heading":"Heading",
"Tabs_PropertySetBeforeInitialization":"{0} cannot be changed before initialization",
"RTE_OrderedList":"Ordered List",
"ReorderList_DropWatcherBehavior_NoChild":"Could not find child of list with id \"{0}\"",
"CascadingDropDown_MethodTimeout":"[Method timeout]",
"RTE_Columns":"Columns",
"RTE_InsertImage":"Insert Image",
"RTE_InsertTable":"Insert Table",
"RTE_Values":"Values",
"RTE_OK":"OK",
"ExtenderBase_PageNotRegisteredForCallbacks":"This Page has not been registered for callbacks",
"Animation_NoDynamicPropertyFound":"AjaxControlToolkit.Animation.createAnimation found no property corresponding to \"{0}\" or \"{1}\"",
"Animation_InvalidBaseType":"AjaxControlToolkit.Animation.registerAnimation can only register types that inherit from AjaxControlToolkit.Animation.Animation",
"RTE_UnorderedList":"Unordered List",
"ResizableControlBehavior_InvalidHandler":"{0} handler not a function, function name, or function text",
"Animation_InvalidColor":"Color must be a 7-character hex representation (e.g. #246ACF), not \"{0}\"",
"RTE_CellColor":"Cell Color",
"PasswordStrength_RemainingMixedCase":"Mixed case characters",
"RTE_Italic":"Italic",
"CascadingDropDown_NoParentElement":"Failed to find parent element \"{0}\"",
"ValidatorCallout_DefaultErrorMessage":"This control is invalid",
"RTE_Indent":"Indent",
"ReorderList_DropWatcherBehavior_CallbackError":"Reorder failed, see details below.\\r\\n\\r\\n{0}",
"PopupControl_NoDefaultProperty":"No default property supported for control \"{0}\" of type \"{1}\"",
"RTE_Normal":"Normal",
"PopupExtender_NoParentElement":"Couldn\u0027t find parent element \"{0}\"",
"RTE_ViewValues":"View Values",
"RTE_Legend":"Legend",
"RTE_Labels":"Labels",
"RTE_CellSpacing":"Cell Spacing",
"PasswordStrength_RemainingNumbers":"{0} more numbers",
"RTE_Border":"Border",
"RTE_Create":"Create",
"RTE_BackgroundColor":"Background Color",
"RTE_Cancel":"Cancel",
"RTE_JustifyFull":"Justify Full",
"RTE_JustifyLeft":"Justify Left",
"RTE_Cut":"Cut",
"ResizableControlBehavior_CannotChangeProperty":"Changes to {0} not supported",
"RTE_ViewSource":"View Source",
"Common_InvalidPaddingUnit":"A unit type of \"{0}\" is invalid for parsePadding",
"RTE_Paste":"Paste",
"ExtenderBase_ControlNotRegisteredForCallbacks":"This Control has not been registered for callbacks",
"Calendar_Today":"Today: {0}",
"Common_DateTime_InvalidFormat":"Invalid format",
"ListSearch_DefaultPrompt":"Type to search",
"CollapsiblePanel_NoControlID":"Failed to find element \"{0}\"",
"RTE_ViewEditor":"View Editor",
"RTE_BarColor":"Bar Color",
"PasswordStrength_DefaultStrengthDescriptions":"NonExistent;Very Weak;Weak;Poor;Almost OK;Barely Acceptable;Average;Good;Strong;Excellent;Unbreakable!",
"RTE_Inserttexthere":"Insert text here",
"Animation_UknownAnimationName":"AjaxControlToolkit.Animation.createAnimation could not find an Animation corresponding to the name \"{0}\"",
"ExtenderBase_InvalidClientStateType":"saveClientState must return a value of type String",
"Rating_CallbackError":"An unhandled exception has occurred:\\r\\n{0}",
"Tabs_OwnerExpected":"owner must be set before initialize",
"DynamicPopulate_WebServiceTimeout":"Web service call timed out",
"PasswordStrength_RemainingLowerCase":"{0} more lower case characters",
"Animation_MissingAnimationName":"AjaxControlToolkit.Animation.createAnimation requires an object with an AnimationName property",
"RTE_JustifyRight":"Justify Right",
"Tabs_ActiveTabArgumentOutOfRange":"Argument is not a member of the tabs collection",
"RTE_CellPadding":"Cell Padding",
"RTE_ClearFormatting":"Clear Formatting",
"AlwaysVisible_ElementRequired":"AjaxControlToolkit.AlwaysVisibleControlBehavior must have an element",
"Slider_NoSizeProvided":"Please set valid values for the height and width attributes in the slider\u0027s CSS classes",
"DynamicPopulate_WebServiceError":"Web Service call failed: {0}",
"PasswordStrength_StrengthPrompt":"Strength: ",
"PasswordStrength_RemainingCharacters":"{0} more characters",
"PasswordStrength_Satisfied":"Nothing more required",
"RTE_Hyperlink":"Hyperlink",
"Animation_NoPropertyFound":"AjaxControlToolkit.Animation.createAnimation found no property corresponding to \"{0}\"",
"PasswordStrength_InvalidStrengthDescriptionStyles":"Text Strength description style classes must match the number of text descriptions.",
"PasswordStrength_GetHelpRequirements":"Get help on password requirements",
"PasswordStrength_InvalidStrengthDescriptions":"Invalid number of text strength descriptions specified",
"RTE_Underline":"Underline",
"Tabs_PropertySetAfterInitialization":"{0} cannot be changed after initialization",
"RTE_Rows":"Rows",
"RTE_Redo":"Redo",
"RTE_Size":"Size",
"RTE_Undo":"Undo",
"RTE_Bold":"Bold",
"RTE_Copy":"Copy",
"RTE_Font":"Font",
"CascadingDropDown_MethodError":"[Method error {0}]",
"RTE_BorderColor":"Border Color",
"RTE_Paragraph":"Paragraph",
"RTE_InsertHorizontalRule":"Insert Horizontal Rule",
"Common_UnitHasNoDigits":"No digits",
"RTE_Outdent":"Outdent",
"Common_DateTime_InvalidTimeSpan":"\"{0}\" is not a valid TimeSpan format",
"Animation_CannotNestSequence":"AjaxControlToolkit.Animation.SequenceAnimation cannot be nested inside AjaxControlToolkit.Animation.ParallelAnimation",
"Shared_BrowserSecurityPreventsPaste":"Your browser security settings don\u0027t permit the automatic execution of paste operations. Please use the keyboard shortcut Ctrl+V instead."
};

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
Type.registerNamespace('AjaxControlToolkit');AjaxControlToolkit.BoxSide = function() {
}
AjaxControlToolkit.BoxSide.prototype = {
Top : 0,
Right : 1,
Bottom : 2,
Left : 3
}
AjaxControlToolkit.BoxSide.registerEnum("AjaxControlToolkit.BoxSide", false);AjaxControlToolkit._CommonToolkitScripts = function() {
}
AjaxControlToolkit._CommonToolkitScripts.prototype = {
_borderStyleNames : ["borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle"],
_borderWidthNames : ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"],
_paddingWidthNames : ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
_marginWidthNames : ["marginTop", "marginRight", "marginBottom", "marginLeft"],
getCurrentStyle : function(element, attribute, defaultValue) {
var currentValue = null;if (element) {
if (element.currentStyle) {
currentValue = element.currentStyle[attribute];} else if (document.defaultView && document.defaultView.getComputedStyle) {
var style = document.defaultView.getComputedStyle(element, null);if (style) {
currentValue = style[attribute];}
}
if (!currentValue && element.style.getPropertyValue) {
currentValue = element.style.getPropertyValue(attribute);}
else if (!currentValue && element.style.getAttribute) {
currentValue = element.style.getAttribute(attribute);} 
}
if ((!currentValue || currentValue == "" || typeof(currentValue) === 'undefined')) {
if (typeof(defaultValue) != 'undefined') {
currentValue = defaultValue;}
else {
currentValue = null;}
} 
return currentValue;},
getInheritedBackgroundColor : function(element) {
if (!element) return '#FFFFFF';var background = this.getCurrentStyle(element, 'backgroundColor');try {
while (!background || background == '' || background == 'transparent' || background == 'rgba(0, 0, 0, 0)') {
element = element.parentNode;if (!element) {
background = '#FFFFFF';} else {
background = this.getCurrentStyle(element, 'backgroundColor');}
}
} catch(ex) {
background = '#FFFFFF';}
return background;},
getLocation : function(element) {
if (element === document.documentElement) {
return new Sys.UI.Point(0,0);}
if (Sys.Browser.agent == Sys.Browser.InternetExplorer && Sys.Browser.version < 7) {
if (element.window === element || element.nodeType === 9 || !element.getClientRects || !element.getBoundingClientRect) return new Sys.UI.Point(0,0);var screenRects = element.getClientRects();if (!screenRects || !screenRects.length) {
return new Sys.UI.Point(0,0);}
var first = screenRects[0];var dLeft = 0;var dTop = 0;var inFrame = false;try {
inFrame = element.ownerDocument.parentWindow.frameElement;} catch(ex) {
inFrame = true;}
if (inFrame) {
var clientRect = element.getBoundingClientRect();if (!clientRect) {
return new Sys.UI.Point(0,0);}
var minLeft = first.left;var minTop = first.top;for (var i = 1;i < screenRects.length;i++) {
var r = screenRects[i];if (r.left < minLeft) {
minLeft = r.left;}
if (r.top < minTop) {
minTop = r.top;}
}
dLeft = minLeft - clientRect.left;dTop = minTop - clientRect.top;}
var ownerDocument = element.document.documentElement;return new Sys.UI.Point(first.left - 2 - dLeft + ownerDocument.scrollLeft, first.top - 2 - dTop + ownerDocument.scrollTop);}
return Sys.UI.DomElement.getLocation(element);},
setLocation : function(element, point) {
Sys.UI.DomElement.setLocation(element, point.x, point.y);},
getContentSize : function(element) {
if (!element) {
throw Error.argumentNull('element');}
var size = this.getSize(element);var borderBox = this.getBorderBox(element);var paddingBox = this.getPaddingBox(element);return {
width : size.width - borderBox.horizontal - paddingBox.horizontal,
height : size.height - borderBox.vertical - paddingBox.vertical
}
},
getSize : function(element) {
if (!element) {
throw Error.argumentNull('element');}
return {
width: element.offsetWidth,
height: element.offsetHeight
};},
setContentSize : function(element, size) {
if (!element) {
throw Error.argumentNull('element');}
if (!size) {
throw Error.argumentNull('size');}
if(this.getCurrentStyle(element, 'MozBoxSizing') == 'border-box' || this.getCurrentStyle(element, 'BoxSizing') == 'border-box') {
var borderBox = this.getBorderBox(element);var paddingBox = this.getPaddingBox(element);size = {
width: size.width + borderBox.horizontal + paddingBox.horizontal,
height: size.height + borderBox.vertical + paddingBox.vertical
};}
element.style.width = size.width.toString() + 'px';element.style.height = size.height.toString() + 'px';},
setSize : function(element, size) {
if (!element) {
throw Error.argumentNull('element');}
if (!size) {
throw Error.argumentNull('size');}
var borderBox = this.getBorderBox(element);var paddingBox = this.getPaddingBox(element);var contentSize = {
width: size.width - borderBox.horizontal - paddingBox.horizontal,
height: size.height - borderBox.vertical - paddingBox.vertical
};this.setContentSize(element, contentSize);},
getBounds : function(element) {
var offset = $common.getLocation(element);return new Sys.UI.Bounds(offset.x, offset.y, element.offsetWidth || 0, element.offsetHeight || 0);}, 
setBounds : function(element, bounds) {
if (!element) {
throw Error.argumentNull('element');}
if (!bounds) {
throw Error.argumentNull('bounds');}
this.setSize(element, bounds);$common.setLocation(element, bounds);},
getClientBounds : function() {
var clientWidth;var clientHeight;switch(Sys.Browser.agent) {
case Sys.Browser.InternetExplorer:
clientWidth = document.documentElement.clientWidth;clientHeight = document.documentElement.clientHeight;break;case Sys.Browser.Safari:
clientWidth = window.innerWidth;clientHeight = window.innerHeight;break;case Sys.Browser.Opera:
clientWidth = Math.min(window.innerWidth, document.body.clientWidth);clientHeight = Math.min(window.innerHeight, document.body.clientHeight);break;default: 
clientWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);clientHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);break;}
return new Sys.UI.Bounds(0, 0, clientWidth, clientHeight);},
getMarginBox : function(element) {
if (!element) {
throw Error.argumentNull('element');}
var box = {
top: this.getMargin(element, AjaxControlToolkit.BoxSide.Top),
right: this.getMargin(element, AjaxControlToolkit.BoxSide.Right),
bottom: this.getMargin(element, AjaxControlToolkit.BoxSide.Bottom),
left: this.getMargin(element, AjaxControlToolkit.BoxSide.Left)
};box.horizontal = box.left + box.right;box.vertical = box.top + box.bottom;return box;},
getBorderBox : function(element) {
if (!element) {
throw Error.argumentNull('element');}
var box = {
top: this.getBorderWidth(element, AjaxControlToolkit.BoxSide.Top),
right: this.getBorderWidth(element, AjaxControlToolkit.BoxSide.Right),
bottom: this.getBorderWidth(element, AjaxControlToolkit.BoxSide.Bottom),
left: this.getBorderWidth(element, AjaxControlToolkit.BoxSide.Left)
};box.horizontal = box.left + box.right;box.vertical = box.top + box.bottom;return box;},
getPaddingBox : function(element) {
if (!element) {
throw Error.argumentNull('element');}
var box = {
top: this.getPadding(element, AjaxControlToolkit.BoxSide.Top),
right: this.getPadding(element, AjaxControlToolkit.BoxSide.Right),
bottom: this.getPadding(element, AjaxControlToolkit.BoxSide.Bottom),
left: this.getPadding(element, AjaxControlToolkit.BoxSide.Left)
};box.horizontal = box.left + box.right;box.vertical = box.top + box.bottom;return box;},
isBorderVisible : function(element, boxSide) {
if (!element) {
throw Error.argumentNull('element');}
if(boxSide < AjaxControlToolkit.BoxSide.Top || boxSide > AjaxControlToolkit.BoxSide.Left) {
throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'AjaxControlToolkit.BoxSide'));}
var styleName = this._borderStyleNames[boxSide];var styleValue = this.getCurrentStyle(element, styleName);return styleValue != "none";},
getMargin : function(element, boxSide) {
if (!element) {
throw Error.argumentNull('element');}
if(boxSide < AjaxControlToolkit.BoxSide.Top || boxSide > AjaxControlToolkit.BoxSide.Left) {
throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'AjaxControlToolkit.BoxSide'));}
var styleName = this._marginWidthNames[boxSide];var styleValue = this.getCurrentStyle(element, styleName);try { return this.parsePadding(styleValue);} catch(ex) { return 0;}
},
getBorderWidth : function(element, boxSide) {
if (!element) {
throw Error.argumentNull('element');}
if(boxSide < AjaxControlToolkit.BoxSide.Top || boxSide > AjaxControlToolkit.BoxSide.Left) {
throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'AjaxControlToolkit.BoxSide'));}
if(!this.isBorderVisible(element, boxSide)) {
return 0;} 
var styleName = this._borderWidthNames[boxSide];var styleValue = this.getCurrentStyle(element, styleName);return this.parseBorderWidth(styleValue);},
getPadding : function(element, boxSide) {
if (!element) {
throw Error.argumentNull('element');}
if(boxSide < AjaxControlToolkit.BoxSide.Top || boxSide > AjaxControlToolkit.BoxSide.Left) {
throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'AjaxControlToolkit.BoxSide'));}
var styleName = this._paddingWidthNames[boxSide];var styleValue = this.getCurrentStyle(element, styleName);return this.parsePadding(styleValue);},
parseBorderWidth : function(borderWidth) {
if (!this._borderThicknesses) {
var borderThicknesses = { };var div0 = document.createElement('div');div0.style.visibility = 'hidden';div0.style.position = 'absolute';div0.style.fontSize = '1px';document.body.appendChild(div0)
var div1 = document.createElement('div');div1.style.height = '0px';div1.style.overflow = 'hidden';div0.appendChild(div1);var base = div0.offsetHeight;div1.style.borderTop = 'solid black';div1.style.borderTopWidth = 'thin';borderThicknesses['thin'] = div0.offsetHeight - base;div1.style.borderTopWidth = 'medium';borderThicknesses['medium'] = div0.offsetHeight - base;div1.style.borderTopWidth = 'thick';borderThicknesses['thick'] = div0.offsetHeight - base;div0.removeChild(div1);document.body.removeChild(div0);this._borderThicknesses = borderThicknesses;}
if (borderWidth) {
switch(borderWidth) {
case 'thin':
case 'medium':
case 'thick':
return this._borderThicknesses[borderWidth];case 'inherit':
return 0;}
var unit = this.parseUnit(borderWidth);Sys.Debug.assert(unit.type == 'px', String.format(AjaxControlToolkit.Resources.Common_InvalidBorderWidthUnit, unit.type));return unit.size;}
return 0;},
parsePadding : function(padding) {
if(padding) {
if(padding == 'inherit') {
return 0;}
var unit = this.parseUnit(padding);Sys.Debug.assert(unit.type == 'px', String.format(AjaxControlToolkit.Resources.Common_InvalidPaddingUnit, unit.type));return unit.size;}
return 0;},
parseUnit : function(value) {
if (!value) {
throw Error.argumentNull('value');}
value = value.trim().toLowerCase();var l = value.length;var s = -1;for(var i = 0;i < l;i++) {
var ch = value.substr(i, 1);if((ch < '0' || ch > '9') && ch != '-' && ch != '.' && ch != ',') {
break;}
s = i;}
if(s == -1) {
throw Error.create(AjaxControlToolkit.Resources.Common_UnitHasNoDigits);}
var type;var size;if(s < (l - 1)) {
type = value.substring(s + 1).trim();} else {
type = 'px';}
size = parseFloat(value.substr(0, s + 1));if(type == 'px') {
size = Math.floor(size);}
return { 
size: size,
type: type
};},
getElementOpacity : function(element) {
if (!element) {
throw Error.argumentNull('element');}
var hasOpacity = false;var opacity;if (element.filters) {
var filters = element.filters;if (filters.length !== 0) {
var alphaFilter = filters['DXImageTransform.Microsoft.Alpha'];if (alphaFilter) {
opacity = alphaFilter.opacity / 100.0;hasOpacity = true;}
}
}
else {
opacity = this.getCurrentStyle(element, 'opacity', 1);hasOpacity = true;}
if (hasOpacity === false) {
return 1.0;}
return parseFloat(opacity);},
setElementOpacity : function(element, value) {
if (!element) {
throw Error.argumentNull('element');}
if (element.filters) {
var filters = element.filters;var createFilter = true;if (filters.length !== 0) {
var alphaFilter = filters['DXImageTransform.Microsoft.Alpha'];if (alphaFilter) {
createFilter = false;alphaFilter.opacity = value * 100;}
}
if (createFilter) {
element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + (value * 100) + ')';}
}
else {
element.style.opacity = value;}
},
getVisible : function(element) {
return (element &&
("none" != $common.getCurrentStyle(element, "display")) &&
("hidden" != $common.getCurrentStyle(element, "visibility")));},
setVisible : function(element, value) {
if (element && value != $common.getVisible(element)) {
if (value) {
if (element.style.removeAttribute) {
element.style.removeAttribute("display");} else {
element.style.removeProperty("display");}
} else {
element.style.display = 'none';}
element.style.visibility = value ? 'visible' : 'hidden';}
},
resolveFunction : function(value) {
if (value) {
if (value instanceof Function) {
return value;} else if (String.isInstanceOfType(value) && value.length > 0) {
var func;if ((func = window[value]) instanceof Function) {
return func;} else if ((func = eval(value)) instanceof Function) {
return func;}
}
}
return null;},
addCssClasses : function(element, classNames) {
for(var i = 0;i < classNames.length;i++) {
Sys.UI.DomElement.addCssClass(element, classNames[i]);}
},
removeCssClasses : function(element, classNames) {
for(var i = 0;i < classNames.length;i++) {
Sys.UI.DomElement.removeCssClass(element, classNames[i]);}
},
setStyle : function(element, style) {
$common.applyProperties(element.style, style);},
removeHandlers : function(element, events) {
for (var name in events) {
$removeHandler(element, name, events[name]);}
},
overlaps : function(r1, r2) {
return r1.x < (r2.x + r2.width)
&& r2.x < (r1.x + r1.width)
&& r1.y < (r2.y + r2.height)
&& r2.y < (r1.y + r1.height);},
containsPoint : function(rect, x, y) {
return x >= rect.x && x < (rect.x + rect.width) && y >= rect.y && y < (rect.y + rect.height);},
isKeyDigit : function(keyCode) { 
return (0x30 <= keyCode && keyCode <= 0x39);},
isKeyNavigation : function(keyCode) { 
return (Sys.UI.Key.left <= keyCode && keyCode <= Sys.UI.Key.down);},
padLeft : function(text, size, ch, truncate) { 
return $common._pad(text, size || 2, ch || ' ', 'l', truncate || false);},
padRight : function(text, size, ch, truncate) { 
return $common._pad(text, size || 2, ch || ' ', 'r', truncate || false);},
_pad : function(text, size, ch, side, truncate) {
text = text.toString();var length = text.length;var builder = new Sys.StringBuilder();if (side == 'r') {
builder.append(text);} 
while (length < size) {
builder.append(ch);length++;}
if (side == 'l') {
builder.append(text);}
var result = builder.toString();if (truncate && result.length > size) {
if (side == 'l') {
result = result.substr(result.length - size, size);} else {
result = result.substr(0, size);}
}
return result;},
__DOMEvents : {
focusin : { eventGroup : "UIEvents", init : function(e, p) { e.initUIEvent("focusin", true, false, window, 1);} },
focusout : { eventGroup : "UIEvents", init : function(e, p) { e.initUIEvent("focusout", true, false, window, 1);} },
activate : { eventGroup : "UIEvents", init : function(e, p) { e.initUIEvent("activate", true, true, window, 1);} },
focus : { eventGroup : "UIEvents", init : function(e, p) { e.initUIEvent("focus", false, false, window, 1);} },
blur : { eventGroup : "UIEvents", init : function(e, p) { e.initUIEvent("blur", false, false, window, 1);} },
click : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("click", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null);} },
dblclick : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("click", true, true, window, 2, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null);} },
mousedown : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("mousedown", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null);} },
mouseup : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("mouseup", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null);} },
mouseover : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("mouseover", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null);} },
mousemove : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("mousemove", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null);} },
mouseout : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("mousemove", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null);} },
load : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("load", false, false);} },
unload : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("unload", false, false);} },
select : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("select", true, false);} },
change : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("change", true, false);} },
submit : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("submit", true, true);} },
reset : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("reset", true, false);} },
resize : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("resize", true, false);} },
scroll : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("scroll", true, false);} }
},
tryFireRawEvent : function(element, rawEvent) {
try {
if (element.fireEvent) {
element.fireEvent("on" + rawEvent.type, rawEvent);return true;} else if (element.dispatchEvent) {
element.dispatchEvent(rawEvent);return true;}
} catch (e) {
}
return false;}, 
tryFireEvent : function(element, eventName, properties) {
try {
if (document.createEventObject) {
var e = document.createEventObject();$common.applyProperties(e, properties || {});element.fireEvent("on" + eventName, e);return true;} else if (document.createEvent) {
var def = $common.__DOMEvents[eventName];if (def) {
var e = document.createEvent(def.eventGroup);def.init(e, properties || {});element.dispatchEvent(e);return true;}
}
} catch (e) {
}
return false;},
wrapElement : function(innerElement, newOuterElement, newInnerParentElement) {
var parent = innerElement.parentNode;parent.replaceChild(newOuterElement, innerElement);(newInnerParentElement || newOuterElement).appendChild(innerElement);},
unwrapElement : function(innerElement, oldOuterElement) {
var parent = oldOuterElement.parentNode;if (parent != null) {
$common.removeElement(innerElement);parent.replaceChild(innerElement, oldOuterElement);}
},
removeElement : function(element) {
var parent = element.parentNode;if (parent != null) {
parent.removeChild(element);}
},
applyProperties : function(target, properties) {
for (var p in properties) {
var pv = properties[p];if (pv != null && Object.getType(pv)===Object) {
var tv = target[p];$common.applyProperties(tv, pv);} else {
target[p] = pv;}
}
},
createElementFromTemplate : function(template, appendToParent, nameTable) {
if (typeof(template.nameTable)!='undefined') {
var newNameTable = template.nameTable;if (String.isInstanceOfType(newNameTable)) {
newNameTable = nameTable[newNameTable];}
if (newNameTable != null) {
nameTable = newNameTable;}
}
var elementName = null;if (typeof(template.name)!=='undefined') {
elementName = template.name;}
var elt = document.createElement(template.nodeName);if (typeof(template.name)!=='undefined' && nameTable) {
nameTable[template.name] = elt;}
if (typeof(template.parent)!=='undefined' && appendToParent == null) {
var newParent = template.parent;if (String.isInstanceOfType(newParent)) {
newParent = nameTable[newParent];}
if (newParent != null) {
appendToParent = newParent;}
}
if (typeof(template.properties)!=='undefined' && template.properties != null) {
$common.applyProperties(elt, template.properties);}
if (typeof(template.cssClasses)!=='undefined' && template.cssClasses != null) {
$common.addCssClasses(elt, template.cssClasses);}
if (typeof(template.events)!=='undefined' && template.events != null) {
$addHandlers(elt, template.events);}
if (typeof(template.visible)!=='undefined' && template.visible != null) {
this.setVisible(elt, template.visible);}
if (appendToParent) {
appendToParent.appendChild(elt);}
if (typeof(template.opacity)!=='undefined' && template.opacity != null) {
$common.setElementOpacity(elt, template.opacity);}
if (typeof(template.children)!=='undefined' && template.children != null) {
for (var i = 0;i < template.children.length;i++) {
var subtemplate = template.children[i];$common.createElementFromTemplate(subtemplate, elt, nameTable);}
}
var contentPresenter = elt;if (typeof(template.contentPresenter)!=='undefined' && template.contentPresenter != null) {
contentPresenter = nameTable[contentPresenter];}
if (typeof(template.content)!=='undefined' && template.content != null) {
var content = template.content;if (String.isInstanceOfType(content)) {
content = nameTable[content];}
if (content.parentNode) {
$common.wrapElement(content, elt, contentPresenter);} else {
contentPresenter.appendChild(content);}
}
return elt;},
prepareHiddenElementForATDeviceUpdate : function () {
var objHidden = document.getElementById('hiddenInputToUpdateATBuffer_CommonToolkitScripts');if (!objHidden) {
var objHidden = document.createElement('input');objHidden.setAttribute('type', 'hidden');objHidden.setAttribute('value', '1');objHidden.setAttribute('id', 'hiddenInputToUpdateATBuffer_CommonToolkitScripts');objHidden.setAttribute('name', 'hiddenInputToUpdateATBuffer_CommonToolkitScripts');if ( document.forms[0] ) {
document.forms[0].appendChild(objHidden);}
}
},
updateFormToRefreshATDeviceBuffer : function () {
var objHidden = document.getElementById('hiddenInputToUpdateATBuffer_CommonToolkitScripts');if (objHidden) {
if (objHidden.getAttribute('value') == '1') {
objHidden.setAttribute('value', '0');} else {
objHidden.setAttribute('value', '1');}
}
}
}
var CommonToolkitScripts = AjaxControlToolkit.CommonToolkitScripts = new AjaxControlToolkit._CommonToolkitScripts();var $common = CommonToolkitScripts;Sys.UI.DomElement.getVisible = $common.getVisible;Sys.UI.DomElement.setVisible = $common.setVisible;Sys.UI.Control.overlaps = $common.overlaps;AjaxControlToolkit._DomUtility = function() {
}
AjaxControlToolkit._DomUtility.prototype = {
isDescendant : function(ancestor, descendant) {
for (var n = descendant.parentNode;n != null;n = n.parentNode) {
if (n == ancestor) return true;}
return false;},
isDescendantOrSelf : function(ancestor, descendant) {
if (ancestor === descendant) 
return true;return AjaxControlToolkit.DomUtility.isDescendant(ancestor, descendant);},
isAncestor : function(descendant, ancestor) {
return AjaxControlToolkit.DomUtility.isDescendant(ancestor, descendant);},
isAncestorOrSelf : function(descendant, ancestor) {
if (descendant === ancestor)
return true;return AjaxControlToolkit.DomUtility.isDescendant(ancestor, descendant);},
isSibling : function(self, sibling) {
var parent = self.parentNode;for (var i = 0;i < parent.childNodes.length;i++) {
if (parent.childNodes[i] == sibling) return true;}
return false;}
}
AjaxControlToolkit._DomUtility.registerClass("AjaxControlToolkit._DomUtility");AjaxControlToolkit.DomUtility = new AjaxControlToolkit._DomUtility();AjaxControlToolkit.TextBoxWrapper = function(element) {
AjaxControlToolkit.TextBoxWrapper.initializeBase(this, [element]);this._current = element.value;this._watermark = null;this._isWatermarked = false;}
AjaxControlToolkit.TextBoxWrapper.prototype = {
dispose : function() {
this.get_element().AjaxControlToolkitTextBoxWrapper = null;AjaxControlToolkit.TextBoxWrapper.callBaseMethod(this, 'dispose');},
get_Current : function() {
this._current = this.get_element().value;return this._current;},
set_Current : function(value) {
this._current = value;this._updateElement();},
get_Value : function() {
if (this.get_IsWatermarked()) {
return "";} else {
return this.get_Current();}
},
set_Value : function(text) {
this.set_Current(text);if (!text || (0 == text.length)) {
if (null != this._watermark) {
this.set_IsWatermarked(true);}
} else {
this.set_IsWatermarked(false);}
},
get_Watermark : function() {
return this._watermark;},
set_Watermark : function(value) {
this._watermark = value;this._updateElement();},
get_IsWatermarked : function() {
return this._isWatermarked;},
set_IsWatermarked : function(isWatermarked) {
if (this._isWatermarked != isWatermarked) {
this._isWatermarked = isWatermarked;this._updateElement();this._raiseWatermarkChanged();}
},
_updateElement : function() {
var element = this.get_element();if (this._isWatermarked) {
if (element.value != this._watermark) {
element.value = this._watermark;}
} else {
if (element.value != this._current) {
element.value = this._current;}
}
},
add_WatermarkChanged : function(handler) {
this.get_events().addHandler("WatermarkChanged", handler);},
remove_WatermarkChanged : function(handler) {
this.get_events().removeHandler("WatermarkChanged", handler);},
_raiseWatermarkChanged : function() {
var onWatermarkChangedHandler = this.get_events().getHandler("WatermarkChanged");if (onWatermarkChangedHandler) {
onWatermarkChangedHandler(this, Sys.EventArgs.Empty);}
}
}
AjaxControlToolkit.TextBoxWrapper.get_Wrapper = function(element) {
if (null == element.AjaxControlToolkitTextBoxWrapper) {
element.AjaxControlToolkitTextBoxWrapper = new AjaxControlToolkit.TextBoxWrapper(element);}
return element.AjaxControlToolkitTextBoxWrapper;}
AjaxControlToolkit.TextBoxWrapper.registerClass('AjaxControlToolkit.TextBoxWrapper', Sys.UI.Behavior);AjaxControlToolkit.TextBoxWrapper.validatorGetValue = function(id) {
var control = $get(id);if (control && control.AjaxControlToolkitTextBoxWrapper) {
return control.AjaxControlToolkitTextBoxWrapper.get_Value();}
return AjaxControlToolkit.TextBoxWrapper._originalValidatorGetValue(id);}
if (typeof(ValidatorGetValue) == 'function') {
AjaxControlToolkit.TextBoxWrapper._originalValidatorGetValue = ValidatorGetValue;ValidatorGetValue = AjaxControlToolkit.TextBoxWrapper.validatorGetValue;}
if (Sys.CultureInfo.prototype._getAbbrMonthIndex) {
try {
Sys.CultureInfo.prototype._getAbbrMonthIndex('');} catch(ex) {
Sys.CultureInfo.prototype._getAbbrMonthIndex = function(value) {
if (!this._upperAbbrMonths) {
this._upperAbbrMonths = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames);}
return Array.indexOf(this._upperAbbrMonths, this._toUpper(value));}
Sys.CultureInfo.CurrentCulture._getAbbrMonthIndex = Sys.CultureInfo.prototype._getAbbrMonthIndex;Sys.CultureInfo.InvariantCulture._getAbbrMonthIndex = Sys.CultureInfo.prototype._getAbbrMonthIndex;}
}

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
/////////////////////////////////////////////////////////////////////////////
Sys.Timer = function() {
Sys.Timer.initializeBase(this);this._interval = 1000;this._enabled = false;this._timer = null;}
Sys.Timer.prototype = {
get_interval: function() {
return this._interval;},
set_interval: function(value) {
if (this._interval !== value) {
this._interval = value;this.raisePropertyChanged('interval');if (!this.get_isUpdating() && (this._timer !== null)) {
this._stopTimer();this._startTimer();}
}
},
get_enabled: function() {
return this._enabled;},
set_enabled: function(value) {
if (value !== this.get_enabled()) {
this._enabled = value;this.raisePropertyChanged('enabled');if (!this.get_isUpdating()) {
if (value) {
this._startTimer();}
else {
this._stopTimer();}
}
}
},
add_tick: function(handler) {
this.get_events().addHandler("tick", handler);},
remove_tick: function(handler) {
this.get_events().removeHandler("tick", handler);},
dispose: function() {
this.set_enabled(false);this._stopTimer();Sys.Timer.callBaseMethod(this, 'dispose');},
updated: function() {
Sys.Timer.callBaseMethod(this, 'updated');if (this._enabled) {
this._stopTimer();this._startTimer();}
},
_timerCallback: function() {
var handler = this.get_events().getHandler("tick");if (handler) {
handler(this, Sys.EventArgs.Empty);}
},
_startTimer: function() {
this._timer = window.setInterval(Function.createDelegate(this, this._timerCallback), this._interval);},
_stopTimer: function() {
window.clearInterval(this._timer);this._timer = null;}
}
Sys.Timer.descriptor = {
properties: [ {name: 'interval', type: Number},
{name: 'enabled', type: Boolean} ],
events: [ {name: 'tick'} ]
}
Sys.Timer.registerClass('Sys.Timer', Sys.Component);
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
/////////////////////////////////////////////////////////////////////////////
Type.registerNamespace('AjaxControlToolkit');AjaxControlToolkit.IDragSource = function() {
}
AjaxControlToolkit.IDragSource.prototype = {
get_dragDataType: function() { throw Error.notImplemented();},
getDragData: function() { throw Error.notImplemented();},
get_dragMode: function() { throw Error.notImplemented();},
onDragStart: function() { throw Error.notImplemented();},
onDrag: function() { throw Error.notImplemented();},
onDragEnd: function() { throw Error.notImplemented();}
}
AjaxControlToolkit.IDragSource.registerInterface('AjaxControlToolkit.IDragSource');/////////////////////////////////////////////////////////////////////////////
AjaxControlToolkit.IDropTarget = function() {
}
AjaxControlToolkit.IDropTarget.prototype = {
get_dropTargetElement: function() { throw Error.notImplemented();},
canDrop: function() { throw Error.notImplemented();},
drop: function() { throw Error.notImplemented();},
onDragEnterTarget: function() { throw Error.notImplemented();},
onDragLeaveTarget: function() { throw Error.notImplemented();},
onDragInTarget: function() { throw Error.notImplemented();}
}
AjaxControlToolkit.IDropTarget.registerInterface('AjaxControlToolkit.IDropTarget');/////////////////////////////////////////////
AjaxControlToolkit.DragMode = function() {
throw Error.invalidOperation();}
AjaxControlToolkit.DragMode.prototype = {
Copy: 0,
Move: 1
}
AjaxControlToolkit.DragMode.registerEnum('AjaxControlToolkit.DragMode');//////////////////////////////////////////////////////////////////
AjaxControlToolkit.DragDropEventArgs = function(dragMode, dragDataType, dragData) {
this._dragMode = dragMode;this._dataType = dragDataType;this._data = dragData;}
AjaxControlToolkit.DragDropEventArgs.prototype = {
get_dragMode: function() {
return this._dragMode || null;},
get_dragDataType: function() {
return this._dataType || null;},
get_dragData: function() {
return this._data || null;}
}
AjaxControlToolkit.DragDropEventArgs.registerClass('AjaxControlToolkit.DragDropEventArgs');AjaxControlToolkit._DragDropManager = function() {
this._instance = null;this._events = null;}
AjaxControlToolkit._DragDropManager.prototype = {
add_dragStart: function(handler) {
this.get_events().addHandler('dragStart', handler);},
remove_dragStart: function(handler) {
this.get_events().removeHandler('dragStart', handler);},
get_events: function() {
if (!this._events) {
this._events = new Sys.EventHandlerList();}
return this._events;},
add_dragStop: function(handler) {
this.get_events().addHandler('dragStop', handler);},
remove_dragStop: function(handler) {
this.get_events().removeHandler('dragStop', handler);},
_getInstance: function() {
if (!this._instance) {
if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
this._instance = new AjaxControlToolkit.IEDragDropManager();}
else {
this._instance = new AjaxControlToolkit.GenericDragDropManager();}
this._instance.initialize();this._instance.add_dragStart(Function.createDelegate(this, this._raiseDragStart));this._instance.add_dragStop(Function.createDelegate(this, this._raiseDragStop));}
return this._instance;},
startDragDrop: function(dragSource, dragVisual, context) {
this._getInstance().startDragDrop(dragSource, dragVisual, context);},
registerDropTarget: function(target) {
this._getInstance().registerDropTarget(target);},
unregisterDropTarget: function(target) {
this._getInstance().unregisterDropTarget(target);},
dispose: function() {
delete this._events;Sys.Application.unregisterDisposableObject(this);Sys.Application.removeComponent(this);},
_raiseDragStart: function(sender, eventArgs) {
var handler = this.get_events().getHandler('dragStart');if(handler) {
handler(this, eventArgs);}
},
_raiseDragStop: function(sender, eventArgs) {
var handler = this.get_events().getHandler('dragStop');if(handler) {
handler(this, eventArgs);}
}
}
AjaxControlToolkit._DragDropManager.registerClass('AjaxControlToolkit._DragDropManager');AjaxControlToolkit.DragDropManager = new AjaxControlToolkit._DragDropManager();AjaxControlToolkit.IEDragDropManager = function() {
AjaxControlToolkit.IEDragDropManager.initializeBase(this);this._dropTargets = null;this._radius = 10;this._activeDragVisual = null;this._activeContext = null;this._activeDragSource = null;this._underlyingTarget = null;this._oldOffset = null;this._potentialTarget = null;this._isDragging = false;this._mouseUpHandler = null;this._documentMouseMoveHandler = null;this._documentDragOverHandler = null;this._dragStartHandler = null;this._mouseMoveHandler = null;this._dragEnterHandler = null;this._dragLeaveHandler = null;this._dragOverHandler = null;this._dropHandler = null;}
AjaxControlToolkit.IEDragDropManager.prototype = {
add_dragStart : function(handler) {
this.get_events().addHandler("dragStart", handler);},
remove_dragStart : function(handler) {
this.get_events().removeHandler("dragStart", handler);},
add_dragStop : function(handler) {
this.get_events().addHandler("dragStop", handler);},
remove_dragStop : function(handler) {
this.get_events().removeHandler("dragStop", handler);},
initialize : function() {
AjaxControlToolkit.IEDragDropManager.callBaseMethod(this, 'initialize');this._mouseUpHandler = Function.createDelegate(this, this._onMouseUp);this._documentMouseMoveHandler = Function.createDelegate(this, this._onDocumentMouseMove);this._documentDragOverHandler = Function.createDelegate(this, this._onDocumentDragOver);this._dragStartHandler = Function.createDelegate(this, this._onDragStart);this._mouseMoveHandler = Function.createDelegate(this, this._onMouseMove);this._dragEnterHandler = Function.createDelegate(this, this._onDragEnter);this._dragLeaveHandler = Function.createDelegate(this, this._onDragLeave);this._dragOverHandler = Function.createDelegate(this, this._onDragOver);this._dropHandler = Function.createDelegate(this, this._onDrop);},
dispose : function() {
if(this._dropTargets) {
for (var i = 0;i < this._dropTargets;i++) {
this.unregisterDropTarget(this._dropTargets[i]);}
this._dropTargets = null;}
AjaxControlToolkit.IEDragDropManager.callBaseMethod(this, 'dispose');},
startDragDrop : function(dragSource, dragVisual, context) {
var ev = window._event;if (this._isDragging) {
return;}
this._underlyingTarget = null;this._activeDragSource = dragSource;this._activeDragVisual = dragVisual;this._activeContext = context;var mousePosition = { x: ev.clientX, y: ev.clientY };dragVisual.originalPosition = dragVisual.style.position;dragVisual.style.position = "absolute";document._lastPosition = mousePosition;dragVisual.startingPoint = mousePosition;var scrollOffset = this.getScrollOffset(dragVisual,  true);dragVisual.startingPoint = this.addPoints(dragVisual.startingPoint, scrollOffset);if (dragVisual.style.position == "absolute") {
dragVisual.startingPoint = this.subtractPoints(dragVisual.startingPoint, $common.getLocation(dragVisual));}
else {
var left = parseInt(dragVisual.style.left);var top = parseInt(dragVisual.style.top);if (isNaN(left)) left = "0";if (isNaN(top)) top = "0";dragVisual.startingPoint = this.subtractPoints(dragVisual.startingPoint, { x: left, y: top });}
this._prepareForDomChanges();dragSource.onDragStart();var eventArgs = new AjaxControlToolkit.DragDropEventArgs(
dragSource.get_dragMode(),
dragSource.get_dragDataType(),
dragSource.getDragData(context));var handler = this.get_events().getHandler('dragStart');if(handler) handler(this,eventArgs);this._recoverFromDomChanges();this._wireEvents();this._drag( true);},
_stopDragDrop : function(cancelled) {
var ev = window._event;if (this._activeDragSource != null) {
this._unwireEvents();if (!cancelled) {
cancelled = (this._underlyingTarget == null);}
if (!cancelled && this._underlyingTarget != null) {
this._underlyingTarget.drop(this._activeDragSource.get_dragMode(), this._activeDragSource.get_dragDataType(),
this._activeDragSource.getDragData(this._activeContext));}
this._activeDragSource.onDragEnd(cancelled);var handler = this.get_events().getHandler('dragStop');if(handler) handler(this,Sys.EventArgs.Empty);this._activeDragVisual.style.position = this._activeDragVisual.originalPosition;this._activeDragSource = null;this._activeContext = null;this._activeDragVisual = null;this._isDragging = false;this._potentialTarget = null;ev.preventDefault();}
},
_drag : function(isInitialDrag) {
var ev = window._event;var mousePosition = { x: ev.clientX, y: ev.clientY };document._lastPosition = mousePosition;var scrollOffset = this.getScrollOffset(this._activeDragVisual,  true);var position = this.addPoints(this.subtractPoints(mousePosition, this._activeDragVisual.startingPoint), scrollOffset);if (!isInitialDrag && parseInt(this._activeDragVisual.style.left) == position.x && parseInt(this._activeDragVisual.style.top) == position.y) {
return;}
$common.setLocation(this._activeDragVisual, position);this._prepareForDomChanges();this._activeDragSource.onDrag();this._recoverFromDomChanges();this._potentialTarget = this._findPotentialTarget(this._activeDragSource, this._activeDragVisual);var movedToOtherTarget = (this._potentialTarget != this._underlyingTarget || this._potentialTarget == null);if (movedToOtherTarget && this._underlyingTarget != null) {
this._leaveTarget(this._activeDragSource, this._underlyingTarget);}
if (this._potentialTarget != null) {
if (movedToOtherTarget) {
this._underlyingTarget = this._potentialTarget;this._enterTarget(this._activeDragSource, this._underlyingTarget);}
else {
this._moveInTarget(this._activeDragSource, this._underlyingTarget);}
}
else {
this._underlyingTarget = null;}
},
_wireEvents : function() {
$addHandler(document, "mouseup", this._mouseUpHandler);$addHandler(document, "mousemove", this._documentMouseMoveHandler);$addHandler(document.body, "dragover", this._documentDragOverHandler);$addHandler(this._activeDragVisual, "dragstart", this._dragStartHandler);$addHandler(this._activeDragVisual, "dragend", this._mouseUpHandler);$addHandler(this._activeDragVisual, "drag", this._mouseMoveHandler);},
_unwireEvents : function() {
$removeHandler(this._activeDragVisual, "drag", this._mouseMoveHandler);$removeHandler(this._activeDragVisual, "dragend", this._mouseUpHandler);$removeHandler(this._activeDragVisual, "dragstart", this._dragStartHandler);$removeHandler(document.body, "dragover", this._documentDragOverHandler);$removeHandler(document, "mousemove", this._documentMouseMoveHandler);$removeHandler(document, "mouseup", this._mouseUpHandler);},
registerDropTarget : function(dropTarget) {
if (this._dropTargets == null) {
this._dropTargets = [];}
Array.add(this._dropTargets, dropTarget);this._wireDropTargetEvents(dropTarget);},
unregisterDropTarget : function(dropTarget) {
this._unwireDropTargetEvents(dropTarget);if (this._dropTargets) {
Array.remove(this._dropTargets, dropTarget);}
},
_wireDropTargetEvents : function(dropTarget) {
var associatedElement = dropTarget.get_dropTargetElement();associatedElement._dropTarget = dropTarget;$addHandler(associatedElement, "dragenter", this._dragEnterHandler);$addHandler(associatedElement, "dragleave", this._dragLeaveHandler);$addHandler(associatedElement, "dragover", this._dragOverHandler);$addHandler(associatedElement, "drop", this._dropHandler);},
_unwireDropTargetEvents : function(dropTarget) {
var associatedElement = dropTarget.get_dropTargetElement();if(associatedElement._dropTarget)
{
associatedElement._dropTarget = null;$removeHandler(associatedElement, "dragenter", this._dragEnterHandler);$removeHandler(associatedElement, "dragleave", this._dragLeaveHandler);$removeHandler(associatedElement, "dragover", this._dragOverHandler);$removeHandler(associatedElement, "drop", this._dropHandler);}
},
_onDragStart : function(ev) {
window._event = ev;document.selection.empty();var dt = ev.dataTransfer;if(!dt && ev.rawEvent) dt = ev.rawEvent.dataTransfer;var dataType = this._activeDragSource.get_dragDataType().toLowerCase();var data = this._activeDragSource.getDragData(this._activeContext);if (data) {
if (dataType != "text" && dataType != "url") {
dataType = "text";if (data.innerHTML != null) {
data = data.innerHTML;}
}
dt.effectAllowed = "move";dt.setData(dataType, data.toString());}
},
_onMouseUp : function(ev) {
window._event = ev;this._stopDragDrop(false);},
_onDocumentMouseMove : function(ev) {
window._event = ev;this._dragDrop();},
_onDocumentDragOver : function(ev) {
window._event = ev;if(this._potentialTarget) ev.preventDefault();},
_onMouseMove : function(ev) {
window._event = ev;this._drag();},
_onDragEnter : function(ev) {
window._event = ev;if (this._isDragging) {
ev.preventDefault();}
else {
var dataObjects = AjaxControlToolkit.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target));for (var i = 0;i < dataObjects.length;i++) {
this._dropTarget.onDragEnterTarget(AjaxControlToolkit.DragMode.Copy, dataObjects[i].type, dataObjects[i].value);}
}
},
_onDragLeave : function(ev) {
window._event = ev;if (this._isDragging) {
ev.preventDefault();}
else {
var dataObjects = AjaxControlToolkit.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target));for (var i = 0;i < dataObjects.length;i++) {
this._dropTarget.onDragLeaveTarget(AjaxControlToolkit.DragMode.Copy, dataObjects[i].type, dataObjects[i].value);}
}
},
_onDragOver : function(ev) {
window._event = ev;if (this._isDragging) {
ev.preventDefault();}
else {
var dataObjects = AjaxControlToolkit.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target));for (var i = 0;i < dataObjects.length;i++) {
this._dropTarget.onDragInTarget(AjaxControlToolkit.DragMode.Copy, dataObjects[i].type, dataObjects[i].value);}
}
},
_onDrop : function(ev) {
window._event = ev;if (!this._isDragging) {
var dataObjects = AjaxControlToolkit.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target));for (var i = 0;i < dataObjects.length;i++) {
this._dropTarget.drop(AjaxControlToolkit.DragMode.Copy, dataObjects[i].type, dataObjects[i].value);}
}
ev.preventDefault();},
_getDropTarget : function(element) {
while (element) {
if (element._dropTarget != null) {
return element._dropTarget;}
element = element.parentNode;}
return null;},
_dragDrop : function() {
if (this._isDragging) {
return;}
this._isDragging = true;this._activeDragVisual.dragDrop();document.selection.empty();},
_moveInTarget : function(dragSource, dropTarget) {
this._prepareForDomChanges();dropTarget.onDragInTarget(dragSource.get_dragMode(), dragSource.get_dragDataType(), dragSource.getDragData(this._activeContext));this._recoverFromDomChanges();},
_enterTarget : function(dragSource, dropTarget) {
this._prepareForDomChanges();dropTarget.onDragEnterTarget(dragSource.get_dragMode(), dragSource.get_dragDataType(), dragSource.getDragData(this._activeContext));this._recoverFromDomChanges();},
_leaveTarget : function(dragSource, dropTarget) {
this._prepareForDomChanges();dropTarget.onDragLeaveTarget(dragSource.get_dragMode(), dragSource.get_dragDataType(), dragSource.getDragData(this._activeContext));this._recoverFromDomChanges();},
_findPotentialTarget : function(dragSource, dragVisual) {
var ev = window._event;if (this._dropTargets == null) {
return null;}
var type = dragSource.get_dragDataType();var mode = dragSource.get_dragMode();var data = dragSource.getDragData(this._activeContext);var scrollOffset = this.getScrollOffset(document.body,  true);var x = ev.clientX + scrollOffset.x;var y = ev.clientY + scrollOffset.y;var cursorRect = { x: x - this._radius, y: y - this._radius, width: this._radius * 2, height: this._radius * 2 };var targetRect;for (var i = 0;i < this._dropTargets.length;i++) {
targetRect = $common.getBounds(this._dropTargets[i].get_dropTargetElement());if ($common.overlaps(cursorRect, targetRect) && this._dropTargets[i].canDrop(mode, type, data)) {
return this._dropTargets[i];}
}
return null;},
_prepareForDomChanges : function() {
this._oldOffset = $common.getLocation(this._activeDragVisual);},
_recoverFromDomChanges : function() {
var newOffset = $common.getLocation(this._activeDragVisual);if (this._oldOffset.x != newOffset.x || this._oldOffset.y != newOffset.y) {
this._activeDragVisual.startingPoint = this.subtractPoints(this._activeDragVisual.startingPoint, this.subtractPoints(this._oldOffset, newOffset));scrollOffset = this.getScrollOffset(this._activeDragVisual,  true);var position = this.addPoints(this.subtractPoints(document._lastPosition, this._activeDragVisual.startingPoint), scrollOffset);$common.setLocation(this._activeDragVisual, position);}
},
addPoints : function(p1, p2) {
return { x: p1.x + p2.x, y: p1.y + p2.y };},
subtractPoints : function(p1, p2) {
return { x: p1.x - p2.x, y: p1.y - p2.y };},
getScrollOffset : function(element, recursive) {
var left = element.scrollLeft;var top = element.scrollTop;if (recursive) {
var parent = element.parentNode;while (parent != null && parent.scrollLeft != null) {
left += parent.scrollLeft;top += parent.scrollTop;if (parent == document.body && (left != 0 && top != 0))
break;parent = parent.parentNode;}
}
return { x: left, y: top };},
getBrowserRectangle : function() {
var width = window.innerWidth;var height = window.innerHeight;if (width == null) {
width = document.body.clientWidth;}
if (height == null) {
height = document.body.clientHeight;}
return { x: 0, y: 0, width: width, height: height };},
getNextSibling : function(item) {
for (item = item.nextSibling;item != null;item = item.nextSibling) {
if (item.innerHTML != null) {
return item;}
}
return null;},
hasParent : function(element) {
return (element.parentNode != null && element.parentNode.tagName != null);}
}
AjaxControlToolkit.IEDragDropManager.registerClass('AjaxControlToolkit.IEDragDropManager', Sys.Component);AjaxControlToolkit.IEDragDropManager._getDataObjectsForDropTarget = function(dropTarget) {
if (dropTarget == null) {
return [];}
var ev = window._event;var dataObjects = [];var dataTypes = [ "URL", "Text" ];var data;for (var i = 0;i < dataTypes.length;i++) {
var dt = ev.dataTransfer;if(!dt && ev.rawEvent) dt = ev.rawEvent.dataTransfer;data = dt.getData(dataTypes[i]);if (dropTarget.canDrop(AjaxControlToolkit.DragMode.Copy, dataTypes[i], data)) {
if (data) {
Array.add(dataObjects, { type : dataTypes[i], value : data });}
}
}
return dataObjects;}
AjaxControlToolkit.GenericDragDropManager = function() {
AjaxControlToolkit.GenericDragDropManager.initializeBase(this);this._dropTargets = null;this._scrollEdgeConst = 40;this._scrollByConst = 10;this._scroller = null;this._scrollDeltaX = 0;this._scrollDeltaY = 0;this._activeDragVisual = null;this._activeContext = null;this._activeDragSource = null;this._oldOffset = null;this._potentialTarget = null;this._mouseUpHandler = null;this._mouseMoveHandler = null;this._keyPressHandler = null;this._scrollerTickHandler = null;}
AjaxControlToolkit.GenericDragDropManager.prototype = {
initialize : function() {
AjaxControlToolkit.GenericDragDropManager.callBaseMethod(this, "initialize");this._mouseUpHandler = Function.createDelegate(this, this._onMouseUp);this._mouseMoveHandler = Function.createDelegate(this, this._onMouseMove);this._keyPressHandler = Function.createDelegate(this, this._onKeyPress);this._scrollerTickHandler = Function.createDelegate(this, this._onScrollerTick);if (Sys.Browser.agent === Sys.Browser.Safari) {
AjaxControlToolkit.GenericDragDropManager.__loadSafariCompatLayer(this);}
this._scroller = new Sys.Timer();this._scroller.set_interval(10);this._scroller.add_tick(this._scrollerTickHandler);},
startDragDrop : function(dragSource, dragVisual, context) {
this._activeDragSource = dragSource;this._activeDragVisual = dragVisual;this._activeContext = context;AjaxControlToolkit.GenericDragDropManager.callBaseMethod(this, "startDragDrop", [dragSource, dragVisual, context]);},
_stopDragDrop : function(cancelled) {
this._scroller.set_enabled(false);AjaxControlToolkit.GenericDragDropManager.callBaseMethod(this, "_stopDragDrop", [cancelled]);},
_drag : function(isInitialDrag) {
AjaxControlToolkit.GenericDragDropManager.callBaseMethod(this, "_drag", [isInitialDrag]);this._autoScroll();},
_wireEvents : function() {
$addHandler(document, "mouseup", this._mouseUpHandler);$addHandler(document, "mousemove", this._mouseMoveHandler);$addHandler(document, "keypress", this._keyPressHandler);},
_unwireEvents : function() {
$removeHandler(document, "keypress", this._keyPressHandler);$removeHandler(document, "mousemove", this._mouseMoveHandler);$removeHandler(document, "mouseup", this._mouseUpHandler);},
_wireDropTargetEvents : function(dropTarget) {
},
_unwireDropTargetEvents : function(dropTarget) {
},
_onMouseUp : function(e) {
window._event = e;this._stopDragDrop(false);},
_onMouseMove : function(e) {
window._event = e;this._drag();},
_onKeyPress : function(e) {
window._event = e;var k = e.keyCode ? e.keyCode : e.rawEvent.keyCode;if (k == 27) {
this._stopDragDrop( true);}
},
_autoScroll : function() {
var ev = window._event;var browserRect = this.getBrowserRectangle();if (browserRect.width > 0) {
this._scrollDeltaX = this._scrollDeltaY = 0;if (ev.clientX < browserRect.x + this._scrollEdgeConst) this._scrollDeltaX = -this._scrollByConst;else if (ev.clientX > browserRect.width - this._scrollEdgeConst) this._scrollDeltaX = this._scrollByConst;if (ev.clientY < browserRect.y + this._scrollEdgeConst) this._scrollDeltaY = -this._scrollByConst;else if (ev.clientY > browserRect.height - this._scrollEdgeConst) this._scrollDeltaY = this._scrollByConst;if (this._scrollDeltaX != 0 || this._scrollDeltaY != 0) {
this._scroller.set_enabled(true);}
else {
this._scroller.set_enabled(false);}
}
},
_onScrollerTick : function() {
var oldLeft = document.body.scrollLeft;var oldTop = document.body.scrollTop;window.scrollBy(this._scrollDeltaX, this._scrollDeltaY);var newLeft = document.body.scrollLeft;var newTop = document.body.scrollTop;var dragVisual = this._activeDragVisual;var position = { x: parseInt(dragVisual.style.left) + (newLeft - oldLeft), y: parseInt(dragVisual.style.top) + (newTop - oldTop) };$common.setLocation(dragVisual, position);}
}
AjaxControlToolkit.GenericDragDropManager.registerClass('AjaxControlToolkit.GenericDragDropManager', AjaxControlToolkit.IEDragDropManager);if (Sys.Browser.agent === Sys.Browser.Safari) {
AjaxControlToolkit.GenericDragDropManager.__loadSafariCompatLayer = function(ddm) {
ddm._getScrollOffset = ddm.getScrollOffset;ddm.getScrollOffset = function(element, recursive) {
return { x: 0, y: 0 };}
ddm._getBrowserRectangle = ddm.getBrowserRectangle;ddm.getBrowserRectangle = function() {
var browserRect = ddm._getBrowserRectangle();var offset = ddm._getScrollOffset(document.body, true);return { x: browserRect.x + offset.x, y: browserRect.y + offset.y,
width: browserRect.width + offset.x, height: browserRect.height + offset.y };}
}
}

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
Type.registerNamespace("Insp");
Type.registerNamespace("Insp.UI");

/////////////////Insp.UI.ModuleCtl//////////////////
Insp.UI.ModuleCtl = function(element)
{
    Insp.UI.ModuleCtl.initializeBase(this,[element]);
    this._showHeader;
    this._showCollapseBtn;
    this._showRefreshBtn;
    this._showCloseBtn;
    this._showEditBtn;
    this._moveable;
    this._moduleID;
    this._updatePanelID;
    this._editSectionID;
    this._contentSectionID;
    this._akamaiUrlPrefix;
    this._akamaiUrlSuffix;
    
    this._minimized;
    this._showEditPart;
    this._moduleTitle;
    
    this._dragBehavior = null;
    this._components = [];
    
    //Delgates
    this._minBtnClickDelegate = null;
    this._editBtnClickDelegate = null;
    this._refreshBtnClickDelegate = null;
    this._closeBtnClickDelegate = null;
    this._propChangedDelegate = null;
}

Insp.UI.ModuleCtl.prototype = {
    get_showHeader: function(){return this._showHeader;},
    set_showHeader: function(value){this._showHeader = value;this.raisePropertyChanged('showHeader');},
    
    get_showCollapseBtn: function(){return this._showCollapseBtn;},
    set_showCollapseBtn: function(value){this._showCollapseBtn = value;this.raisePropertyChanged('showCollapseBtn');},
    
    get_showRefreshBtn: function(){return this._showRefreshBtn;},
    set_showRefreshBtn: function(value){this._showRefreshBtn = value;this.raisePropertyChanged('showRefreshBtn');},
    
    get_showCloseBtn: function(){return this._showCloseBtn;},
    set_showCloseBtn: function(value){this._showCloseBtn = value;this.raisePropertyChanged('showCloseBtn');},
    
    get_showEditBtn: function(){return this._showEditBtn;},
    set_showEditBtn: function(value){this._showEditBtn = value;this.raisePropertyChanged('showEditBtn');},
    
    get_moveable: function(){return this._moveable;},
    set_moveable: function(value){this._moveable = value;this.raisePropertyChanged('moveable');},
    
    get_moduleID: function(){return this._moduleID;},
    set_moduleID: function(value){this._moduleID = value;this.raisePropertyChanged('moduleID');},
    
    get_updatePanelID: function(){return this._updatePanelID;},
    set_updatePanelID: function(value){this._updatePanelID = value;this.raisePropertyChanged('updatePanelID');},
    
    get_editSectionID: function(){return this._editSectionID;},
    set_editSectionID: function(value){this._editSectionID = value;this.raisePropertyChanged('editSectionID');},
    
    get_contentSectionID: function(){return this._contentSectionID;},
    set_contentSectionID: function(value){this._contentSectionID = value;this.raisePropertyChanged('contentSectionID');},
    
    get_akamaiUrlPrefix: function(){return this._akamaiUrlPrefix;},
    set_akamaiUrlPrefix: function(value){this._akamaiUrlPrefix = value;this.raisePropertyChanged('akamaiUrlPrefix');},
    
    get_akamaiUrlSuffix: function(){return this._akamaiUrlSuffix;},
    set_akamaiUrlSuffix: function(value){this._akamaiUrlSuffix = value;this.raisePropertyChanged('akamaiUrlSuffix');},
    
    get_minimized: function(){return this._minimized;},
    set_minimized: function(value){this._minimized = value;this.raisePropertyChanged('minimized');},
    
    get_showEditPart: function(){return this._showEditPart;},
    set_showEditPart: function(value){this._showEditPart = value;this.raisePropertyChanged('showEditPart');},

    get_moduleTitle: function(){return this._moduleTitle;},
    set_moduleTitle: function(value)
    {
        this._moduleTitle = value;this.raisePropertyChanged('moduleTitle');
        this._setTitleInternal(this._moduleTitle);
    },
        
    add_moduleClosing: function(handler){this.get_events().addHandler('moduleClosing',handler);},
    remove_moduleClosing: function(handler){this.get_events().removeHandler('moduleClosing',handler);},    
    
    initialize: function()
    {
        Insp.UI.ModuleCtl.callBaseMethod(this,'initialize');
        
        this._initModuleFromProps();

        if (this._closeBtnClickDelegate === null) {
            this._closeBtnClickDelegate = Function.createDelegate(this, this._closeBtnClickHandler);
        }
        $addHandler($get('CloseBtn',this.get_element()),"click",this._closeBtnClickDelegate);
                
        if (this._minBtnClickDelegate === null) {
            this._minBtnClickDelegate = Function.createDelegate(this, this._minBtnClickHandler);
        }
        $addHandler($get('MinBtn',this.get_element()),"click",this._minBtnClickDelegate);
        
        if (this._editBtnClickDelegate === null) {
            this._editBtnClickDelegate = Function.createDelegate(this, this._editBtnClickHandler);
        }
        $addHandler($get('EditBtn',this.get_element()),"click",this._editBtnClickDelegate);

        if (this._refreshBtnClickDelegate === null) {
            this._refreshBtnClickDelegate = Function.createDelegate(this, this._refreshBtnClickHandler);
        }
        $addHandler($get('RefreshBtn',this.get_element()),"click",this._refreshBtnClickDelegate);
                
        if (this._propChangedDelegate === null) {
            this._propChangedDelegate = Function.createDelegate(this, this._propChangedHandler);
        }
        this.add_propertyChanged(this._propChangedDelegate);
        
        if(Insp && Insp.Behaviors && Insp.Behaviors.DraggableBehavior && this.get_moveable())
        {
            if(typeof($get(this.get_updatePanelID())["DraggableBehavior"]) !== 'undefined'){
                this._dragBehavior = $get(this.get_updatePanelID())["DraggableBehavior"];
                this._dragBehavior.set_handleID("TitleCell");
            }else
                this._dragBehavior = $create(Insp.Behaviors.DraggableBehavior,{name:"DraggableBehavior",handleID:"TitleCell",dragFlavor:"Insp.UI.Module"},null,null,$get(this.get_updatePanelID()));
        }
             
    },
    dispose: function()
    {
        //if(this._dragBehavior)delete this._dragBehavior;
        
        this.remove_propertyChanged(this._propChangedDelegate);
        if (this._propChangedDelegate) delete this._propChangedDelegate;
        
        $removeHandler($get('RefreshBtn',this.get_element()),"click",this._refreshBtnClickDelegate);
        if (this._refreshBtnClickDelegate) delete this._refreshBtnClickDelegate;
        
        $removeHandler($get('MinBtn',this.get_element()),"click",this._minBtnClickDelegate);
        if (this._minBtnClickDelegate) delete this._minBtnClickDelegate;
        
        $removeHandler($get('EditBtn',this.get_element()),"click",this._editBtnClickDelegate);
        if (this._editBtnClickDelegate) delete this._editBtnClickDelegate;
        
        $removeHandler($get('CloseBtn',this.get_element()),"click",this._closeBtnClickDelegate);
        if (this._closeBtnClickDelegate) delete this._closeBtnClickDelegate;
        
        for(var a in this._components)delete this._components[a];
        Insp.UI.ModuleCtl.callBaseMethod(this,'dispose');
    },
    _initModuleFromProps: function()
    {
        var o = $get("HeaderPanel",this.get_element());
        var m = $get('minimizeContainer',this.get_element());
        if(this._showHeader){if(o){o.style.display="";o.visibility="visible";}}
        else{if(o){o.style.display="none";o.visibility="hidden";}m.style.border='none';}
        
        var o = $get("FooterPanel",this.get_element());
        if(this._showHeader){if(o){o.style.display="";o.visibility="visible";}}
        else{if(o){o.style.display="none";o.visibility="hidden";}}
        
        var o = $get("MinBtnCell",this.get_element());
        if(this._showCollapseBtn){if(o){o.style.display="";o.visibility="visible";}}
        else{if(o){o.style.display="none";o.visibility="hidden";}}

        var o = $get("RefreshBtnCell",this.get_element());
        if(this._showRefreshBtn){if(o){o.style.display="";o.visibility="visible";}}
        else{if(o){o.style.display="none";o.visibility="hidden";}}
        
        var o = $get("CloseBtnCell",this.get_element());
        if(this._showCloseBtn){if(o){o.style.display="";o.visibility="visible";}}
        else{if(o){o.style.display="none";o.visibility="hidden";}}
        
        var o = $get("EditBtnCell",this.get_element());
        if(this._showEditBtn){if(o){o.style.display="";o.visibility="visible";}}
        else{if(o){o.style.display="none";o.visibility="hidden";}}
        
        var o = $get("TitleCell",this.get_element());
        if(this._moveable){if(o && !Sys.UI.DomElement.containsCssClass(o,"itemHandle")){Sys.UI.DomElement.addCssClass(o,"itemHandle");}}
        else{if(o)Sys.UI.DomElement.removeCssClass(o,"itemHandle");}
    },
    
    _minMaxModule:function(min)
    {
        var o = $get('minimizeContainer',this.get_element());
        var m = $get('MinBtn',this.get_element());
        var e = $get('EditBtn',this.get_element());
        if(o)
        {   (min)?o.style.display="none":o.style.display="block";
            (min)?o.visibility="hidden":o.visibility="visible";
            if(min){Sys.UI.DomElement.addCssClass(m,"ptModIcnMax");Sys.UI.DomElement.removeCssClass(m,"ptModIcnMin");}
            else{Sys.UI.DomElement.addCssClass(m,"ptModIcnMin");Sys.UI.DomElement.removeCssClass(m,"ptModIcnMax");}
            if(min){
                Sys.UI.DomElement.addCssClass(e,"ptModIcnEdit_disabled");Sys.UI.DomElement.removeCssClass(e,"ptModIcnEdit");
                $removeHandler($get('EditBtn',this.get_element()),"click",this._editBtnClickDelegate);
            }else{
                Sys.UI.DomElement.addCssClass(e,"ptModIcnEdit");Sys.UI.DomElement.removeCssClass(e,"ptModIcnEdit_disabled");
                $addHandler($get('EditBtn',this.get_element()),"click",this._editBtnClickDelegate);
            }
        }
    },
    _hideShowEditPart:function(show)
    {
        var o = $get(this.get_editSectionID(),this.get_element());
        if(o)
        {   (show)?o.style.display="block":o.style.display="none";
            (show)?o.visibility="visible":o.visibility="hidden";
        }
    },
    refreshModule:function()
    {
        var o = $get("RefreshBtn",this.get_element());
        if(o)o.className = "ImgWait";
        __doPostBack(this.get_updatePanelID(),'');
    },
    closeModule:function()
    {
        var f = this.get_events().getHandler('moduleClosing');
        if(f)f(this,args);
        var confirmclose = confirm(strModuleDelete);
        if(confirmclose==true){
            $get(this.get_updatePanelID()).style.display='none';
            WSCall("delete",this.get_updatePanelID(),null,null,null);
            LogClient('903','portalmain');
        }
    },
    _setTitleInternal:function(titleStr)
    {
        var o = $get('HeaderLabel',this.get_element());
        if(o){o.innerHTML=titleStr;o.title=titleStr};
    },
    _propChangedHandler:function(sender,prop)
    {
        if(prop.get_propertyName() == 'minimized')
        {this._minMaxModule(this.get_minimized());}
        else if(prop.get_propertyName() == 'showEditPart')
        {this._hideShowEditPart(this.get_showEditPart());}
    },
    _closeBtnClickHandler: function()
    {
        this.closeModule();
    },
    _minBtnClickHandler:function(evt)
    {
        this.set_minimized(!this.get_minimized());
    },
    _editBtnClickHandler:function(evt)
    {
        this.set_showEditPart(!this.get_showEditPart());
    },
    _refreshBtnClickHandler:function(evt)
    {
        this.refreshModule();
    },
    addComponent:function(e)
    {
        if(Sys.Component.isInstanceOfType(e))this._components[e.get_id()] = e;
    },
    getComponents:function()
    {
        var a=[];b= this._components;
        for(var c in b)a[a.length] = b[c];
        return a;
    },
    findComponent:function(id)
    {
        return this._components[id];
    },
    removeComponent:function(b)
    {
        var a = b.get_id();
        if(a){delete this._components[a];}
    }
}
Insp.UI.ModuleCtl.registerClass("Insp.UI.ModuleCtl", Sys.UI.Control, Sys.IContainer);

/////////////////Insp.UI.ModuleChildCtl//////////////////
Insp.UI.ModuleChildCtl = function(element)
{
    Insp.UI.ModuleChildCtl.initializeBase(this,[element]);
}

Insp.UI.ModuleChildCtl.prototype = {
    get_module: function()
    {
        return this.get_parent();
    },

    initialize: function()
    {
        if(Insp.UI.ModuleCtl.isInstanceOfType(this.get_parent())) this.get_parent().addComponent(this);
        Insp.UI.ModuleChildCtl.callBaseMethod(this,'initialize');
    },
    dispose: function()
    {
        Insp.UI.ModuleChildCtl.callBaseMethod(this,'dispose');
    }
}
Insp.UI.ModuleChildCtl.registerClass("Insp.UI.ModuleChildCtl", Sys.UI.Control);

/////////////////Insp.UI.ModuleContentCtl//////////////////
Insp.UI.ModuleContentCtl = function(element)
{
    Insp.UI.ModuleContentCtl.initializeBase(this,[element]);
}

Insp.UI.ModuleContentCtl.prototype = {
    initialize: function()
    {
        Insp.UI.ModuleContentCtl.callBaseMethod(this,'initialize');
    },
    dispose: function()
    {
        Insp.UI.ModuleContentCtl.callBaseMethod(this,'dispose');
    }
}
Insp.UI.ModuleContentCtl.registerClass("Insp.UI.ModuleContentCtl", Insp.UI.ModuleChildCtl);

/////////////////Insp.UI.ModuleEditCtl//////////////////
Insp.UI.ModuleEditCtl = function(element)
{
    Insp.UI.ModuleEditCtl.initializeBase(this,[element]);
    this._keyDelegate = null;    
}

Insp.UI.ModuleEditCtl.prototype = {
    add_enterPressed: function(handler){this.get_events().addHandler('enterPressed',handler);},
    remove_enterPressed: function(handler){this.get_events().removeHandler('enterPressed',handler);}, 
    
    initialize: function()
    {
        Insp.UI.ModuleEditCtl.callBaseMethod(this,'initialize');
        if(this._keyDelegate === null)
            this._keyDelegate = Function.createDelegate(this, this._keyHandler);
        $addHandler(this.get_element(),'keydown',this._keyDelegate);
    },
    dispose: function()
    {
        $removeHandler(this.get_element(),'keydown',this._keyDelegate);
        if(this._keyDelegate) delete this._keyDelegate;
        Insp.UI.ModuleEditCtl.callBaseMethod(this,'dispose');
    },
    _keyHandler: function(evt)
    {
        if(evt.keyCode == Sys.UI.Key.enter)
        {
            var f = this.get_events().getHandler('enterPressed');
            if(f)f(this,Sys.EventArgs.Empty);
        }
    }
}
Insp.UI.ModuleEditCtl.registerClass("Insp.UI.ModuleEditCtl", Insp.UI.ModuleChildCtl);


/////////////////Insp.UI.Paginator//////////////////

Insp.UI.Paginator = function(element)
{
    Insp.UI.Paginator.initializeBase(this,[element]);
    this._currentPage=1;
    this._itemsPerPage = 0;
    this._totalItems = 0;
    this._numPageLinks = 5;
    
    this._startPage=1;
    this._components = [];
    
    this._totalPageLinks = 0;
    this._propChangeDelegate = null;
    this._pageClickDelegate = null;
}

Insp.UI.Paginator.prototype = {
    get_currentPage: function(){return this._currentPage;},
    set_currentPage: function(value){this._currentPage = value;this.raisePropertyChanged('currentPage');},

    get_itemsPerPage: function(){return this._itemsPerPage;},
    set_itemsPerPage: function(value){this._itemsPerPage = value;this.raisePropertyChanged('itemsPerPage');},

    get_totalItems: function(){return this._totalItems;},
    set_totalItems: function(value){this._totalItems = value;this.raisePropertyChanged('totalItems');},

    get_numPageLinks: function(){return this._numPageLinks;},
    set_numPageLinks: function(value){this._numPageLinks = value;this.raisePropertyChanged('numPageLinks');},
    
    add_pageChanged: function(handler){this.get_events().addHandler('pageChanged',handler);},
    remove_pageChanged: function(handler){this.get_events().removeHandler('pageChanged',handler);},
    
    dispose: function()
    {
    
        if(this._propChangeDelegate) delete this._propChangeDelegate;
        Insp.UI.Paginator.callBaseMethod(this,'dispose');
    },
    initialize: function()
    {
        Insp.UI.Paginator.callBaseMethod(this,'initialize');    
        this.get_element().innerHTML = "<div id='paginateDiv'></div>";
        this.addCssClass("ptModPager");
        
        if (this._propChangeDelegate === null) {
            this._propChangeDelegate = Function.createDelegate(this, this._propChangeHandler);
        }
        this.add_propertyChanged(this._propChangeDelegate);
                
        if (this._pageClickDelegate === null) {
            this._pageClickDelegate = Function.createDelegate(this, this._pageClickHandler);
        }
    },
    _propChangeHandler: function(sender,property)
    {
        if(property.get_propertyName() == 'currentPage')
        {
            var pn = this.get_currentPage();
            if(pn<1){this.set_currentPage(1);return;}
            if(pn>this._totalPageLinks){this.set_currentPage(this._totalPageLinks);return;}
            //correction of startPage
            if(pn >= this._startPage+this.get_numPageLinks() || pn<this._startPage)
            {
                this._startPage = parseInt(pn/this.get_numPageLinks());
            }
            
            var args = new Insp.UI.PageChangeArg(pn,pn*this.get_itemsPerPage());
            var f = this.get_events().getHandler('pageChanged');
            if(f)f(this,args);
            
            this.updateLinks();
        }
    },
    _pageClickHandler:function(sender, args)
    {
        if(args.get_pageValue() == '-1')
        {
            if(this._startPage+this.get_numPageLinks() <= this._totalPageLinks)
                this._startPage+=this.get_numPageLinks();
            this.set_currentPage(this._startPage);
        }
        else if(args.get_pageValue() == '0')
        {
            if(this._startPage-this.get_numPageLinks() > 0)
                this._startPage-=this.get_numPageLinks();
            this.set_currentPage(this._startPage);
        }
        else
        {
            var pn = args.get_pageValue();
            if(pn<1 || pn > this._totalPageLinks)return;
            this.set_currentPage(pn);
        }
    },
    updated: function()
    {
        this._initLinks();
        this.updateLinks();
        Insp.UI.Paginator.callBaseMethod(this,'updated');
    },
    _createLinkCtl:function(id,text)
    {
        var oSpan = document.createElement('SPAN');
		oSpan.id = "pageLinkItem"+id;
		$get('paginateDiv',this.get_element()).appendChild(oSpan);   
		var e = $create(Insp.UI.PaginatorLink,{pageValue:id, pageText:text},{pageClicked:this._pageClickDelegate},{parent:this.get_id()},$get(oSpan.id,this.get_element()));
		this.addComponent(e); 
    },
    _findLinkCtl:function(id)
    {
        return this.findComponent('pageLinkItem' + id);
    },
    _initLinks:function()
    {
        if(!this._findLinkCtl('0'))this._createLinkCtl('0',"<span style='font-family:Arial;'>&#9668;</span>");//prev
        
        var numlinks = parseInt(this.get_totalItems()/this.get_itemsPerPage());
        if(this.get_totalItems()%this.get_itemsPerPage()) numlinks++;
        this._totalPageLinks = numlinks;
        
        for(var i = 1;i<=this._totalPageLinks;i++)
            if(!this._findLinkCtl(i))this._createLinkCtl(i,i);
        
        if(!this._findLinkCtl('-1'))this._createLinkCtl('-1',"<span style='font-family:Arial;'>&#9658;</span>");//next
    },
    updateLinks:function()
    {
        if(this._startPage > 1)
            this._findLinkCtl('0').set_visible(true);
        else
            this._findLinkCtl('0').set_visible(false);
            
        for(var i = 1;i<=this._totalPageLinks;i++)
            if(this._findLinkCtl(i))this._findLinkCtl(i).set_visible(false);
        
        for(var i= this._startPage;i< this._startPage + this.get_numPageLinks();i++)
            if(this._findLinkCtl(i))
            {   
                this._findLinkCtl(i).set_visible(true);
                if(this.get_currentPage() == i)
                    this._findLinkCtl(i).set_selected(true);
                else
                    this._findLinkCtl(i).set_selected(false);
            }
            
        this._findLinkCtl('-1').set_visible(false);
        if((this._startPage + this.get_numPageLinks()) < this._totalPageLinks)
            this._findLinkCtl('-1').set_visible(true);
        
        this.set_visible(true);
            
    },
    addComponent:function(e)
    {
        if(Sys.Component.isInstanceOfType(e))
            this._components[e.get_id()] = e;
    },
    getComponents:function()
    {
        var a=[];b= this._components;
        for(var c in b)
        {
            a[a.length] = b[c];
        }
        return a;
    },
    findComponent:function(id)
    {
        return this._components[id];
    },
    removeComponent:function(b)
    {
        var a = b.get_id();
        if(a){delete this._components[a];}
    }
}

Insp.UI.Paginator.registerClass('Insp.UI.Paginator',Sys.UI.Control,Sys.IContainer);

Insp.UI.PageChangeArg = function(pagenum, startItem)
{
    Insp.UI.PageChangeArg.initializeBase(this);
    this._currentPage = pagenum;
    this._startItem = startItem;
}
Insp.UI.PageChangeArg.prototype = 
{
    get_currentPage: function(){return this._currentPage;},
    set_currentPage:function(value){this._currentPage = value;},
    
    get_startItem: function(){return this._startItem;},
    set_startItem:function(value){this._startItem = value;}
}
Insp.UI.PageChangeArg.registerClass("Insp.UI.PageChangeArg", Sys.EventArgs);

Insp.UI.PageClickArg = function(pageVal)
{
    Insp.UI.PageClickArg.initializeBase(this);
    this._pageValue = pageVal;
}
Insp.UI.PageClickArg.prototype = 
{
    get_pageValue: function(){return this._pageValue;},
    set_pageValue:function(value){this._pageValue = value;}
}
Insp.UI.PageClickArg.registerClass("Insp.UI.PageClickArg", Sys.EventArgs);

Insp.UI.PaginatorLink = function(element)
{
    Insp.UI.PaginatorLink.initializeBase(this,[element]);
    this._pageValue = null;
    this._selected = false;
    this._pageText = null;
    
    this._propChangeDelegate = null;
    this._linkClickDelegate = null;
}

Insp.UI.PaginatorLink.prototype = {
    get_pageValue: function(){return this._pageValue;},
    set_pageValue: function(value){this._pageValue = value;this.raisePropertyChanged('pageValue');},

    get_selected: function(){return this._selected;},
    set_selected: function(value){this._selected = value;this.raisePropertyChanged('selected');},

    get_pageText: function(){return this._pageText;},
    set_pageText: function(value){this._pageText = value;this.raisePropertyChanged('pageText');},
    
    add_pageClicked: function(handler){this.get_events().addHandler('pageClicked',handler);},
    remove_pageClicked: function(handler){this.get_events().removeHandler('pageClicked',handler);},
    
    dispose: function()
    {
        $removeHandler(this.get_element(),'click',this._linkClickDelegate);
        if(this._linkClickDelegate) delete this._linkClickDelegate;
        if(this._propChangeDelegate) delete this._propChangeDelegate;
        Insp.UI.PaginatorLink.callBaseMethod(this,'dispose');
    },
    initialize: function()
    {
        Insp.UI.PaginatorLink.callBaseMethod(this,'initialize');    
     
        this.get_element().innerHTML = this.get_pageText();   
        this.addCssClass("ptModPageLink");
        
        this.set_visibilityMode(Sys.UI.VisibilityMode.collapse);
		 
        if (this._propChangeDelegate === null) {
            this._propChangeDelegate = Function.createDelegate(this, this._propChangeHandler);
        }
        
        if (this._linkClickDelegate === null) {
            this._linkClickDelegate = Function.createDelegate(this, this._linkClickHandler);
        }
        $addHandler(this.get_element(),'click',this._linkClickDelegate);
            
        this.add_propertyChanged(this._propChangeDelegate);
    },
    _propChangeHandler: function(sender,property)
    {
        if(property.get_propertyName() == 'selected')
        {
            if(this.get_selected())this.addCssClass('selPage');
            else this.removeCssClass('selPage');
        }
    },
    _linkClickHandler: function()
    {
        var args = new Insp.UI.PageClickArg(this.get_pageValue());
        var f = this.get_events().getHandler('pageClicked');
        if(f)f(this,args);
    },
    updated: function()
    {
        Insp.UI.PaginatorLink.callBaseMethod(this,'updated');
    }
}

Insp.UI.PaginatorLink.registerClass('Insp.UI.PaginatorLink',Sys.UI.Control);



/////////////////Insp.UI.TabStrip//////////////////

Insp.UI.TabStrip = function(element)
{
    Insp.UI.TabStrip.initializeBase(this,[element]);
    this._items=null;
    this._currentTab = null;

    this._components = [];
    
    this._propChangeDelegate = null;
    this._tabClickDelegate = null;
    this._leftNavClickDlg = null;
    this._rightNavClickDlg = null;
}

Insp.UI.TabStrip.prototype = {
    get_items: function(){return this._items;},
    set_items: function(value){this._items = value;this.raisePropertyChanged('items');},
    
    get_currentTab: function(){return this._currentTab;},
    set_currentTab: function(value){this._currentTab = value;this.raisePropertyChanged('currentTab');},
    
    add_tabChanged: function(handler){this.get_events().addHandler('tabChanged',handler);},
    remove_tabChanged: function(handler){this.get_events().removeHandler('tabChanged',handler);},
    
    dispose: function()
    {
    
        if(this._propChangeDelegate) delete this._propChangeDelegate;
        Insp.UI.TabStrip.callBaseMethod(this,'dispose');
    },
    initialize: function()
    {
        Insp.UI.TabStrip.callBaseMethod(this,'initialize');    
        this.get_element().innerHTML = "<div id='leftNav' class='ptModTSLeftNavOff'>&#9668</div> <div id='rightNav' class='ptModTSRightNavOn'>&#9658</div> <div id='tabItems' class='ptModTSItems'></div> ";
        this.addCssClass("ptModTabStrip");
        
        if (this._propChangeDelegate === null) {
            this._propChangeDelegate = Function.createDelegate(this, this._propChangeHandler);
        }
        this.add_propertyChanged(this._propChangeDelegate);
                
        if (this._tabClickDelegate === null) {
            this._tabClickDelegate = Function.createDelegate(this, this._tabClickHandler);
        }
        if (this._leftNavClickDlg === null) {
            this._leftNavClickDlg = Function.createDelegate(this, this._leftNavClickHnd);
        }
        $addHandler($get("leftNav",this.get_element()),'click',this._leftNavClickDlg);
        if (this._rightNavClickDlg === null) {
            this._rightNavClickDlg = Function.createDelegate(this, this._rightNavClickHnd);
        }
        $addHandler($get("rightNav",this.get_element()),'click',this._rightNavClickDlg);
    },
    _propChangeHandler: function(sender,property)
    {
        if(property.get_propertyName() == 'currentTab')
        {
            var args = new Insp.UI.TabChangeArg(this.get_currentTab());
            var f = this.get_events().getHandler('tabChanged');
            if(f)f(this,args);
            
            this.updateLinks();
        }
    },
    _tabClickHandler:function(sender, args)
    {
		var tv = args.get_tabValue();
        this.set_currentTab(tv);
    },
    updated: function()
    {
        this._initLinks();
        this.updateLinks();
        this._scrollTabIntoView(this.get_currentTab());
        Insp.UI.TabStrip.callBaseMethod(this,'updated');
    },
    _createLinkCtl:function(val,text)
    {
        var oSpan = document.createElement('SPAN');
		oSpan.id = "tabLinkItem"+val;
		$get('tabItems',this.get_element()).appendChild(oSpan);   
		var e = $create(Insp.UI.TabStripLink,{tabValue:val, tabText:text},{tabClicked:this._tabClickDelegate},{parent:this.get_id()},$get(oSpan.id,this.get_element()));
		this.addComponent(e); 
    },
    _findLinkCtl:function(id)
    {
        return this.findComponent('tabLinkItem' + id);
    },
    _initLinks:function()
    {
		for(var i = 0;i<this._items.length;i++)
            if(!this._findLinkCtl(this._items[i].value))this._createLinkCtl(this._items[i].value,this._items[i].name);

    },
    updateLinks:function()
    {
           
       for(var i = 0;i<this._items.length;i++)
            if(this._findLinkCtl(this._items[i].value))this._findLinkCtl(this._items[i].value).set_selected(false);
        
		var t = this._findLinkCtl(this.get_currentTab());
		if(t)t.set_selected(true);
 
        this.set_visible(true);
    },
    _leftNavClickHnd: function(sender,evt)
    {
		var lasthid = null;
		for(var i = 0;i<this._items.length;i++)
		{
			var e=this._findLinkCtl(this._items[i].value);
            if(!e.get_visible())
				lasthid = e;
			else
			{
				if(lasthid)lasthid.set_visible(true);
				if(i<=1){
					$get("leftNav",this.get_element()).className = "ptModTSLeftNavOff";
				}
				break;
			}
		}
		$get("rightNav",this.get_element()).className = "ptModTSRightNavOn";
    },
    _rightNavClickHnd: function(sender,evt)
    {
		for(var i = 0;i<this._items.length;i++)
		{
			var e=this._findLinkCtl(this._items[i].value);
            if(e.get_visible())
            {
				if(i!=(this._items.length-1)){
					e.set_visible(false);
					if(i==(this._items.length-2))
						$get("rightNav",this.get_element()).className = "ptModTSRightNavOff";
				}else{
					$get("rightNav",this.get_element()).className = "ptModTSRightNavOff";
				}
				break;
            }
		}
		$get("leftNav",this.get_element()).className = "ptModTSLeftNavOn";
    },
    _scrollTabIntoView: function(val)
    {
		var vis = false;
		for(var i = 0;i<this._items.length;i++)
		{
			var e=this._findLinkCtl(this._items[i].value);
            if(this._items[i].value==val)
            {
				vis=true;
				if(i!=0)$get("leftNav",this.get_element()).className = "ptModTSLeftNavOn";
				else $get("leftNav",this.get_element()).className = "ptModTSLeftNavOff";
				if(i<(this._items.length-1))$get("rightNav",this.get_element()).className = "ptModTSRightNavOn";
				else $get("rightNav",this.get_element()).className = "ptModTSRightNavOff";
            }
            e.set_visible(vis);
		}
    },
    addComponent:function(e)
    {
        if(Sys.Component.isInstanceOfType(e))
            this._components[e.get_id()] = e;
    },
    getComponents:function()
    {
        var a=[];b= this._components;
        for(var c in b)
        {
            a[a.length] = b[c];
        }
        return a;
    },
    findComponent:function(id)
    {
        return this._components[id];
    },
    removeComponent:function(b)
    {
        var a = b.get_id();
        if(a){delete this._components[a];}
    }
}

Insp.UI.TabStrip.registerClass('Insp.UI.TabStrip',Sys.UI.Control,Sys.IContainer);

Insp.UI.TabChangeArg = function(tabval)
{
    Insp.UI.TabChangeArg.initializeBase(this);
    this._currentTab = tabval;
}
Insp.UI.TabChangeArg.prototype = 
{
    get_currentTab: function(){return this._currentTab;},
    set_currentTab:function(value){this._currentTab = value;}
}
Insp.UI.TabChangeArg.registerClass("Insp.UI.TabChangeArg", Sys.EventArgs);

Insp.UI.TabClickArg = function(tabVal)
{
    Insp.UI.TabClickArg.initializeBase(this);
    this._tabValue = tabVal;
}
Insp.UI.TabClickArg.prototype = 
{
    get_tabValue: function(){return this._tabValue;},
    set_tabValue:function(value){this._tabValue = value;}
}
Insp.UI.TabClickArg.registerClass("Insp.UI.TabClickArg", Sys.EventArgs);

Insp.UI.TabStripLink = function(element)
{
    Insp.UI.TabStripLink.initializeBase(this,[element]);
    this._tabValue = null;
    this._selected = false;
    this._tabText = null;
    
    this._propChangeDelegate = null;
    this._linkClickDelegate = null;
}

Insp.UI.TabStripLink.prototype = {
    get_tabValue: function(){return this._tabValue;},
    set_tabValue: function(value){this._tabValue = value;this.raisePropertyChanged('tabValue');},

    get_selected: function(){return this._selected;},
    set_selected: function(value){this._selected = value;this.raisePropertyChanged('selected');},

    get_tabText: function(){return this._tabText;},
    set_tabText: function(value){this._tabText = value;this.raisePropertyChanged('tabText');},
    
    add_tabClicked: function(handler){this.get_events().addHandler('tabClicked',handler);},
    remove_tabClicked: function(handler){this.get_events().removeHandler('tabClicked',handler);},
    
    dispose: function()
    {
        $removeHandler(this.get_element(),'click',this._linkClickDelegate);
        if(this._linkClickDelegate) delete this._linkClickDelegate;
        if(this._propChangeDelegate) delete this._propChangeDelegate;
        Insp.UI.TabStripLink.callBaseMethod(this,'dispose');
    },
    initialize: function()
    {
        Insp.UI.TabStripLink.callBaseMethod(this,'initialize');    
     
        this.get_element().innerHTML = "<span class='ptModTSItemLeft'></span><span class='ptModTSItem'>"+this.get_tabText()+"</span><span class='ptModTSItemRight'></span>";   
        this.get_element().className = "ptModTSLinkOff";
        
        this.set_visibilityMode(Sys.UI.VisibilityMode.collapse);
		 
        if (this._propChangeDelegate === null) {
            this._propChangeDelegate = Function.createDelegate(this, this._propChangeHandler);
        }
        
        if (this._linkClickDelegate === null) {
            this._linkClickDelegate = Function.createDelegate(this, this._linkClickHandler);
        }
        $addHandler(this.get_element(),'click',this._linkClickDelegate);
            
        this.add_propertyChanged(this._propChangeDelegate);
    },
    _propChangeHandler: function(sender,property)
    {
        if(property.get_propertyName() == 'selected')
        {
            if(this.get_selected())this.get_element().className = "ptModTSLinkOn";
            else this.get_element().className = "ptModTSLinkOff";
        }
    },
    _linkClickHandler: function()
    {
        var args = new Insp.UI.TabClickArg(this.get_tabValue());
        var f = this.get_events().getHandler('tabClicked');
        if(f)f(this,args);
    },
    updated: function()
    {
        Insp.UI.TabStripLink.callBaseMethod(this,'updated');
    }
}

Insp.UI.TabStripLink.registerClass('Insp.UI.TabStripLink',Sys.UI.Control);


if (typeof(Sys) !== 'undefined')Sys.Application.notifyScriptLoaded();

Type.registerNamespace("Insp");
Type.registerNamespace("Insp.UI");

Insp.UI.ClientLottery = function(element)
{
    Insp.UI.ClientLottery.initializeBase(this,[element]);
    this._regionId = "";
    this._drawCount = 0;
    this._gameIds = "";
    this._countryId = "USA";
    this._title = "";
    
    this.lotteryGames = null;
    this.showGameIds = null;
    this._bShowAllGames= false;
    
    this._callbackDelegate = null;
    this._pageChangedDelegate = null;
}

Insp.UI.ClientLottery.prototype = {
    get_regionId: function(){return this._regionId;},
    set_regionId: function(value){this._regionId = value;this.raisePropertyChanged('regionId');},
    
    get_drawCount: function(){return this._drawCount;},
    set_drawCount: function(value){this._drawCount = value;this.raisePropertyChanged('drawCount');},

    get_gameIds: function(){return this._gameIds;},
    set_gameIds: function(value){this._gameIds = value;this.showGameIds=this._gameIds.split('|');this._bShowAllGames = (value == "*")?true:false;this.raisePropertyChanged('gameIds');},

    get_countryId: function(){return this._countryId;},
    set_countryId: function(value){this._countryId = value;this.raisePropertyChanged('countryId');},

    get_title: function(){return this._title;},
    set_title: function(value){this._title = value;this.raisePropertyChanged('title');},
    
    dispose: function()
    {
        if(this._callbackDelegate) delete this._callbackDelegate;
		Insp.UI.ClientLottery.callBaseMethod(this,'dispose');
    },
    initialize: function()
    {
        Insp.UI.ClientLottery.callBaseMethod(this,'initialize');
		this.addCssClass("ptModLottery");
		this.addCssClass("NHLoading");
		
    	if (this._callbackDelegate === null) {
            this._callbackDelegate = Function.createDelegate(this, this.callbackHandler);
        }
    },
    updated: function()
    {
        this.get_module().set_moduleTitle(this.get_title());
        Portal.ClientLotterySvc.a(this.get_regionId(),this.get_drawCount(),this.get_countryId(),this._callbackDelegate);
        Insp.UI.ClientLottery.callBaseMethod(this,'updated');
    },
    callbackHandler: function(results)
    {
		this.removeCssClass("NHLoading");
        this.lotteryGames = results;
        this._createComponents();
    },
    _createComponents: function()
    {
        var ctDiv = $get("contentDiv",this.get_element());
        var errDiv = $get("errorDiv",this.get_element());
        var hdrDiv = $get("headerDiv",this.get_element());
        
        if(this.lotteryGames == null || this.lotteryGames.length == 0)
        {            
            ctDiv.style.display = "none";
            hdrDiv.style.display = "none";
            errDiv.innerHTML = strGenericError;
            errDiv.style.display="";
            errDiv.className="ptGenericError";
            
        }else
        {
        
            errDiv.style.display = "none";
            hdrDiv.style.display = "";
            if(this._bShowAllGames ==false && (this.showGameIds == null || this.showGameIds.length == 0 || (this.showGameIds.length == 1 && this.showGameIds[0] == "")) )
            {
                errDiv.innerHTML = strNoGameMsg;
                errDiv.style.display = "";
                ctDiv.style.display="none";
                hdrDiv.style.display = "none";
            }else{
                errDiv.style.display = "none";
                ctDiv.style.display="";
                for(var i=0;i<this.lotteryGames.length;i++)
                {
                    var gm = this.lotteryGames[i];
                    var bShowGame = false;
                    if(this._bShowAllGames)
                    {
                        bShowGame = true;
                    }else
                    {
                        for(var j=0;j<this.showGameIds.length;j++)
                        {
                            if(gm.gameId == this.showGameIds[j])
                            {
                                bShowGame = true;
                            }
                        }
                    }
                    if(bShowGame)this._displayGame(gm);
                }
            }
        }
    },
    _displayGame:function(gm)
    {
        var ctDiv = $get("contentDiv",this.get_element());
        
        var gDiv = document.createElement('div');
        ctDiv.appendChild(gDiv);
        gDiv.className = "LotteryGameCont";
        gDiv.innerHTML = "<div id='GameName' class='GameTitle'>"+gm.name+"</div>" +
            "<div id='NextGame'><span id='nextDate' class='GameDate'>" +
                gm.nextDrawDate +
                "</span><span id='nextJackpot' class='GameResults'>"+ strClientLottery_NextGame +" "+ ((gm.jackpot!="0")?"$"+parseInt(gm.jackpot).localeFormat('i'):"") +"</span></div>" +
            "<div id='ResultsDiv' style='width:100%'></div>";
        
        var rDiv = $get('ResultsDiv',gDiv);
        var htm = "";
        for(var i=0;i<gm.drawings.length;i++)
        {
            var dr=gm.drawings[i];
            var reg = new RegExp(",","ig");
            var res = dr.results.toString().replace(reg,", ");
            htm+="<div><span class='GameDate'>"+dr.drawingDate+"</span>"+
                    "<span class='GameResults'>"+res+
                    "</span><span class='GameBonus'>"+((dr.bonus)?"<span style='font-family:Arial'>&nbsp;&#187;</span>"+dr.bonus:"")+"</span></div>";
        }
        rDiv.innerHTML = htm;
    },
    _getDisplayDate:function(dt)
    {
        var d= new Date(dt);
        return d.format("MM/dd");
    }
}

Insp.UI.ClientLottery.registerClass('Insp.UI.ClientLottery',Insp.UI.ModuleContentCtl);

Insp.UI.ClientLotteryEdit = function(element)
{
    Insp.UI.ClientLotteryEdit.initializeBase(this,[element]);
    this._regionId = "";
    this._drawCount = 0;
    this._gameIds = "";
    this._countryId = "USA";
    
    this._bShowAllGames = false;
    this.showGameIds = null;
    //Delegates
    this._regionCallbackDelegate = null;
    this._gamesCallbackDelegate = null;
    this._regionChangedDelegate = null;
    this._cancelClickDelegate = null;
    this._saveClickDelegate = null;
    this._propChangedDelegate = null
    this._saveSuccessDelegate = null;
    this._saveFailureDelegate = null;
}

Insp.UI.ClientLotteryEdit.prototype = {
    get_regionId: function(){return this._regionId;},
    set_regionId: function(value){this._regionId = value;this.raisePropertyChanged('regionId');},
    
    get_drawCount: function(){return this._drawCount;},
    set_drawCount: function(value){this._drawCount = value;this.raisePropertyChanged('drawCount');},

    get_gameIds: function(){return this._gameIds;},
    set_gameIds: function(value){this._gameIds = value;this.showGameIds=this._gameIds.split('|');this._bShowAllGames = (value == "*")?true:false;this.raisePropertyChanged('gameIds');},
    
    get_countryId: function(){return this._countryId;},
    set_countryId: function(value){this._countryId = value;this.raisePropertyChanged('countryId');},
    
    dispose: function()
    {
        if(this._saveFailureDelegate) delete this._saveFailureDelegate;
        if(this._saveSuccessDelegate) delete this._saveSuccessDelegate;
        if(this._propChangedDelegate) delete this._propChangedDelegate;
        $removeHandler($get('BtnSave',this.get_element()),'click',this._saveClickDelegate);
        if(this._saveClickDelegate) delete this._saveClickDelegate;
        $removeHandler($get('BtnCancel',this.get_element()),'click',this._cancelClickDelegate);
        if(this._cancelClickDelegate) delete this._cancelClickDelegate;
        $removeHandler($get('SelState',this.get_element()),'change',this._regionChangedDelegate);
        if(this._regionChangedDelegate) delete this._regionChangedDelegate;
        if(this._gamesCallbackDelegate) delete this._gamesCallbackDelegate;
        if(this._regionCallbackDelegate) delete this._regionCallbackDelegate;
        Insp.UI.ClientLotteryEdit.callBaseMethod(this,'dispose');
    },
    initialize: function()
    {
        Insp.UI.ClientLotteryEdit.callBaseMethod(this,'initialize');
        this.get_element().parentNode.style.position = "relative";
        this._disableSaveButton(true);
        
        if (this._regionCallbackDelegate === null) {
            this._regionCallbackDelegate = Function.createDelegate(this, this._regionCallbackHandler);
        }
        if (this._gamesCallbackDelegate === null) {
            this._gamesCallbackDelegate = Function.createDelegate(this, this._gamesCallbackHandler);
        }
        if (this._regionChangedDelegate === null) {
            this._regionChangedDelegate = Function.createDelegate(this, this._regionChangedHandler);
        }
        $addHandler($get('SelState',this.get_element()),'change',this._regionChangedDelegate);
        if (this._cancelClickDelegate === null) {
            this._cancelClickDelegate = Function.createDelegate(this, this._cancelClickHandler);
        }
        $addHandler($get('BtnCancel',this.get_element()),'click',this._cancelClickDelegate);
        if (this._saveClickDelegate === null) {
            this._saveClickDelegate = Function.createDelegate(this, this._saveClickHandler);
        }
        $addHandler($get('BtnSave',this.get_element()),'click',this._saveClickDelegate);
        if (this._propChangedDelegate === null) {
            this._propChangedDelegate = Function.createDelegate(this, this._propChangedHandler);
        }
        if (this._saveSuccessDelegate === null) {
            this._saveSuccessDelegate = Function.createDelegate(this, this._saveSuccessHandler);
        }
        if (this._saveFailureDelegate === null) {
            this._saveFailureDelegate = Function.createDelegate(this, this._saveFailureHandler);
        }                                 
        var oHLP = $get('SelDrawings',this.get_element());
        for(var i =1;i<=5;i++)
        {
            var oOPT = document.createElement('OPTION');;
            oOPT.value = ""+i;
            oOPT.innerHTML = i;
            oHLP.appendChild(oOPT);
        }
        
        this.get_module().add_propertyChanged(this._propChangedDelegate);
        this._initValues();
        
    },
    _initValues: function()
    {
        $get("SelDrawings",this.get_element()).value = this.get_drawCount();
        $get("SelState",this.get_element()).value = this.get_regionId();
        this._updateGameSelection();
    },
    updated: function()
    {
        Portal.ClientLotterySvc.b(this.get_countryId() ,this._regionCallbackDelegate);
        Insp.UI.ClientLotteryEdit.callBaseMethod(this,'updated');
    },
    _regionCallbackHandler:function(regions)
    {
        this._populateRegions(regions);
        this._retrieveGames(this.get_regionId());
        
    },
    _retrieveGames:function(regId)
    {
        this._disableSaveButton(true);
        $get('GamesListDiv',this.get_element()).innerHTML = "";
        Portal.ClientLotterySvc.a(regId,0,this.get_countryId(),this._gamesCallbackDelegate);
    },
    _gamesCallbackHandler:function(games)
    {
        this._populateGames(games);
        this._disableSaveButton(false);
    },
    _populateRegions:function(regions)
    {
        var oST = $get('SelState',this.get_element());
        for(var i =0;i<regions.length;i++)
        {
            var oOPT = document.createElement('OPTION');;
            oOPT.value = regions[i].regionId;
            oOPT.innerHTML = regions[i].name;
            oST.appendChild(oOPT);
        }
        oST.value = this.get_regionId();
    },
    _populateGames:function(games)
    {
        oGL = $get('GamesListDiv',this.get_element());
        oGL.innerHTML = "";
        for(var i =0;i<games.length;i++)
        {
            var oCT = document.createElement('div');
            oCT.innerHTML = "<input id='"+games[i].gameId+"' checked='checked' type='checkbox'><label for='"+games[i].gameId+"'>"+games[i].name+"</label>";
            oGL.appendChild(oCT);
        }
        this._updateGameSelection();
    },
    _updateGameSelection:function()
    {
        if($get("SelState",this.get_element()).value == this.get_regionId())
        {
            d = $get('GamesListDiv',this.get_element());
            var ids = d.getElementsByTagName('input');
            for(var i=0;i<ids.length;i++){
                var bshow = false;
                if(this._bShowAllGames)
                    bshow = true;
                else{
                    for(var j=0;j<this.showGameIds.length;j++){
                        if(ids[i].id == this.showGameIds[j])
                        {bshow= true;break;}
                    }
                }
                if(!bshow)ids[i].checked = false;
                else ids[i].checked = true;
            }
        }
    },
    _regionChangedHandler:function(evt)
    {
        var currReg = $get("SelState",this.get_element()).value;
        this._retrieveGames(currReg);
    },
    _disableSaveButton:function(state)
    {
        $get("BtnSave",this.get_element()).disabled = state;
    },
    _cancelClickHandler: function(eventObj)
    {
        this.get_module().set_showEditPart(false);
    },
    _saveClickHandler:function(evt)
    {
        this._saveConfig();
    },
    _saveConfig:function()
    {
        var oST=$get("SelState",this.get_element());
        var regID = oST.value;
        var regName = oST.options[oST.selectedIndex].text;
        var gameIds = "";
        d = $get('GamesListDiv',this.get_element());
        var ids = d.getElementsByTagName('input');
        for(var i=0;i<ids.length;i++){
            if(ids[i].checked)
            {
                gameIds += (gameIds == "")?"":"|";
                gameIds += ids[i].id;
            }
        }
        var numDraws = 1;
        numDraws = $get("SelDrawings",this.get_element()).value;
        
        Portal.ClientLotterySvc.s(regID,regName,gameIds,numDraws,this.get_module().get_moduleID(),this._saveSuccessDelegate,this._saveFailureDelegate);
    },
    _propChangedHandler:function(sender,prop)
    {
        if(prop.get_propertyName() == 'showEditPart' && !this.get_module().get_showEditPart())
        {        
            this._initValues();
            this._retrieveGames(this.get_regionId());
        }
    },
    _saveSuccessHandler:function(result)
    {
        if(result == "success")
        {
            if(this.get_module())this.get_module().refreshModule();
        }
    },
    _saveFailureHandler:function(result)
    {
    }
}

Insp.UI.ClientLotteryEdit.registerClass('Insp.UI.ClientLotteryEdit',Insp.UI.ModuleEditCtl);

// Since this script is not loaded by System.Web.Handlers.ScriptResourceHandler
// invoke Sys.Application.notifyScriptLoaded to notify ScriptManager 
// that this is the end of the script.
if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();

Type.registerNamespace("Insp");
Type.registerNamespace("Insp.UI");

Insp.UI.ClientMovie = function(element)
{    
    Insp.UI.ClientMovie.initializeBase(this,[element]);
    this._title = "";
    this._contentRating = "";
    this._pageNum=0;
    this._responseperpage=0;
    this._releasestatus="";
    this._sortmode="";
    this._numShowtimeresponse = 0;
    
    this._moviename="";
    this._buttonClickDelegate=null;
    this._buttonfeatMovieCloseClickDelegate = null;
    this._keyPressDelegate=null;
    this._showtimeresult=null;
    this._movieid =""; 
    this._movieresult=null;  
    this._showtimeresultDelegate=null;      
    this._callbackDelegate = null;
    this._failureDelegate = null;       
    //this._innerdivClickDelegate  = [];  
     this._innerdivClickDelegate  = new Array();  
    this._components = [];    
}

Insp.UI.ClientMovie.prototype = {
    get_title: function(){ return this._title;},
    set_title: function(value){ this._title = value;this.raisePropertyChanged('title');},
    
    get_contentRating: function(){return this._contentRating;},
    set_contentRating: function(value){this._contentRating = value;this.raisePropertyChanged('contentRating');},
    
    get_pageNum: function(){return this._pageNum;},
    set_pageNum: function(value){this._pageNum = value;this.raisePropertyChanged('pageNum');},
    
    get_pageNum: function(){return this._pageNum;},
    set_pageNum: function(value){this._pageNum = value;this.raisePropertyChanged('pageNum');},
    
    get_responseperpage: function(){return this._responseperpage;},
    set_responseperpage: function(value){this._responseperpage = value;this.raisePropertyChanged('responseperpage');},
    
    get_releasestatus: function(){return this._releasestatus;},
    set_releasestatus: function(value){this._releasestatus = value;this.raisePropertyChanged('releasestatus');},
    
    get_sortmode: function(){return this._sortmode;},
    set_sortmode: function(value){this._sortmode = value;this.raisePropertyChanged('sortmode');},
    
    get_numShowtimeresponse: function(){return this._numShowtimeresponse;},
    set_numShowtimeresponse: function(value){this._numShowtimeresponse = value;this.raisePropertyChanged('numShowtimeresponse');},
    
    dispose: function()
    {
        if(this._callbackDelegate) delete this._callbackDelegate;
        var sb = $get('featuredMoviesubmit',this.get_element());
        if(sb)$removeHandler(sb,'click',this._buttonClickDelegate);
        
        if(this._buttonClickDelegate) delete this._buttonClickDelegate;
        
		Insp.UI.ClientMovie.callBaseMethod(this,'dispose');
    },
    initialize: function()
    {
        Insp.UI.ClientMovie.callBaseMethod(this,'initialize');
				
        //Create a div and table for movie module
        
        this.get_element().innerHTML = "<div id='errorDiv' class='feedErrorMessage' style='display:none;'>"+strClientMovieFeatured_FeedErrMsg+"</div>" +
        "<div id='moviecontainer' class='ptMovieClient'>" +
            "<table cellspacing='0' cellspadding='0' border='0' border-collapse: collapse> <tr> <td> <table cellspacing='0' cellspadding='0' border='0' border-collapse: collapse><tr><td id='movieinfo'></td></tr><tr><td class='movoffwebmargintop'><div id='movieofficialwebsite'/></td></tr><tr><td class='movtrailormarginbottom'><div id='movietrailer'/></td></tr></table></td></tr>" +
            "<tr><td style='height:auto'><div id='theatershowing' class='theatershowing'/></td></tr><tr><td><div id='findshowitme'/></td></tr></table></div>";
        
        this.addCssClass("ptMovieClient");
        this.addCssClass("FMLoading");
		if (this._callbackDelegate === null) {
            this._callbackDelegate = Function.createDelegate(this, this.callbackHandler);
        }
        if (this._failureDelegate === null) {
            this._failureDelegate = Function.createDelegate(this, this._failureHandler);
        }        
    },
    updated: function()
    {
        Portal.MovieShowTimesSvc.featuredMovieOrLatestMovie(this.get_contentRating(), this.get_pageNum(), this.get_responseperpage(), this.get_releasestatus(), this.get_sortmode(), this._callbackDelegate,this._failureDelegate);
        Insp.UI.ClientMovie.callBaseMethod(this,'updated');
    },
    callbackHandler: function(results)
    {  	
        this.removeCssClass("FMLoading");
        if(results.length <=0)
        {
            this._showErrorMsg();
        }else{
            this._movieresult = results[0];
            this._clearComponents();
            this._createComponents();
        }
    },
    _failureHandler:function()
    {
        this._showErrMsg();
    },
    _showErrorMsg:function()
    {
        var ed = $get("errorDiv",this.get_element());
        if(ed)ed.style.display="block";
        var mc = $get("moviecontainer",this.get_element());
        if(mc)mc.style.display="none";
    },     
    buttonClickDelegateHandler: function()
    {  
        if($get('featuredMovieinputzipcode',this.get_element()).value != ""){
            if(this._showtimeresultDelegate === null){ 
                this._showtimeresultDelegate = Function.createDelegate(this, this.showtimeresultDelegateHandler);        
                Portal.MovieShowTimesSvc.featuredMovieTheaterListOrTheaterList($get('featuredMovieinputzipcode',this.get_element()).value, this.get_pageNum(), this.get_numShowtimeresponse(),this._movieid, this._showtimeresultDelegate);
                $get('errmsg', this.get_element()).style.display = "none";
            }    
         }
         else
         {
            $get('theatershowing', this.get_element()).innerHTML = "<div class='hline'/>";
            var errorMsg = strClientMovieFeatured_ErrMsg;
            $get('errmsg', this.get_element()).innerHTML = "<br><br/>" +errorMsg; 
            $get('errmsg', this.get_element()).style.display = "block";
            
         }       
    },   
     
    
    showtimeresultDelegateHandler: function(showtimeresults)
    {   
       if(showtimeresults.length > 0){     //if started
        var featuredMovieinputzipcodeTemp = $get('featuredMovieinputzipcode',this.get_element()).value;
        this._showtimeresult = showtimeresults;
        $get('theatershowing', this.get_element()).innerHTML = "<div class='hline'/>";
        var innerHtml =  $get('theatershowing', this.get_element()).innerHTML;
        innerHtml = innerHtml + "<img src='icon_close_section.gif' id='featMovieCloseIcon' class='ptImgClose'>" + "<div class='tsTitle'>" + strClientMovieFeatured_TtrShow+" " +  '"' + this._moviename + '"' + " "+strClientMovieFeatured_Near+" " +featuredMovieinputzipcodeTemp+ "</div>" ;
        $get('theatershowing', this.get_element()).innerHTML = innerHtml;
        var innerdiv = "";
        for(var i = 0 ; i < showtimeresults.length ; i ++)
        {               
            var innerdivid = "min_max_small" + i;
            var innerdivaddress = "address_icon_min_max_small" + i;
            var innersrcid = "icon_min_max_small" + i;  
            innerdiv = innerdiv  + "<br><div id=" + "'" + innerdivid + "'" + "><span id=" + "'" + i + "'" + " class='theatername'> <span class='arrow' id=" + "'" + innersrcid + "'" + ">&#9658;</span> " + this._showtimeresult[i].theaterNameforC + 
            "</span><br>" + "<div class='theatermovieshowing'>" +this._showtimeresult[i].theaterShowingforC +" </div>" + "</div>" + "<div id=" + "'" + innerdivaddress + "'" + " class='innerdivaddress'>" +this._showtimeresult[i].theaterLocationforC + "</div>";                
            
            
            
        }
        innerHtml = innerHtml + innerdiv + "<div class='hline'/>";
        $get('theatershowing', this.get_element()).innerHTML = innerHtml;
        
        
        $get('featuredMovieinputzipcode',this.get_element()).value = "";
        
        
        //Adding handlers
        
        for(var i = 0 ; i < showtimeresults.length ; i ++)    
        { 
          
          this._innerdivClickDelegate [i] = null;     
          var innerdivid = "min_max_small" + i;
          if(this._innerdivClickDelegate[i]  === null)  
          {
            this._innerdivClickDelegate[i]  = Function.createDelegate(this, this.innerdivClickDelegateHandler);            
            $addHandler($get(innerdivid ,this.get_element()),'click',this._innerdivClickDelegate [i]);
          }
        }
       } //end of if 
       else
       {
            var featuredMovieinputzipcodeTemp = $get('featuredMovieinputzipcode',this.get_element()).value;   
            $get('theatershowing', this.get_element()).innerHTML = "<div class='hline'/>";
            var innerHtml =  $get('theatershowing', this.get_element()).innerHTML;
            innerHtml = innerHtml + "<img src='icon_close_section.gif' id='featMovieCloseIcon' class='ptImgClose'>" + "<div class='error'>"+strClientMovieFeatured_MvNotFnd+" " +featuredMovieinputzipcodeTemp +"</div>" ;
            innerHtml = innerHtml + "<div class='hline'/>";
            $get('theatershowing', this.get_element()).innerHTML = innerHtml;
        
        
            $get('featuredMovieinputzipcode',this.get_element()).value = "";
         
       } 
         if (this._buttonfeatMovieCloseClickDelegate === null) 
          {
            this._buttonfeatMovieCloseClickDelegate = Function.createDelegate(this, this.buttonfeatMovieCloseClickDelegateHandler);
          }
          $addHandler($get('featMovieCloseIcon',this.get_element()),'click',this._buttonfeatMovieCloseClickDelegate);
          
        this._showtimeresultDelegate = null;
    },
    innerdivClickDelegateHandler : function (position)
    {   
                
         var currIcon = "" ;
         if((position.target.id.toString()) == "")return;
         if((position.target.id.toString()).indexOf("icon_min_max_small") != -1)
         {
            currIcon = position.target.id.toString();
         }
         else if((position.target.id.toString()).indexOf("min_max_small") != -1)
         {
            currIcon = "icon_" + position.target.id.toString();
         }
         else
         {
            currIcon = "icon_min_max_small" + position.target.id;
         }
          var currAddress = "address_" + currIcon;
         if(($get( currAddress, this.get_element()).style.display == "none" ) || ($get( currAddress, this.get_element()).style.display == ""))
         {
           
           
             $get( currIcon, this.get_element()).innerHTML = "&#9660;";
            $get( currAddress, this.get_element()).style.display = "block";
            
         }else
         {
             $get( currIcon, this.get_element()).innerHTML = "&#9658";           
            $get( currAddress, this.get_element()).style.display = "none";
            
         }         
    },
   
    
    buttonfeatMovieCloseClickDelegateHandler: function()
    {
        $get('theatershowing', this.get_element()).innerHTML = "<div class='hline'/>";
    }, 
     
    keyPressDelegateHandler:function(key)
    {
        if(key.rawEvent.keyCode == "13"){        
            if($get('featuredMovieinputzipcode',this.get_element()).value != ""){
              if(this._showtimeresultDelegate === null){            
                this._showtimeresultDelegate = Function.createDelegate(this, this.showtimeresultDelegateHandler);        
                Portal.MovieShowTimesSvc.featuredMovieTheaterListOrTheaterList($get('featuredMovieinputzipcode',this.get_element()).value, this.get_pageNum(), this.get_numShowtimeresponse(),this._movieid, this._showtimeresultDelegate);
                $get('errmsg', this.get_element()).style.display = "none";
              }  
             }else
             {
                $get('theatershowing', this.get_element()).innerHTML = "<div class='hline'/>";
                var errorMsg = strClientMovieFeatured_ErrMsg;
                $get('errmsg', this.get_element()).innerHTML = "<br><br/>" +errorMsg; 
                $get('errmsg', this.get_element()).style.display = "block";
             }   
        }
     }, 
        
    _createComponents: function()
    {            
          this._moviename = this._movieresult.movieNameforC;
          this._movieid=this._movieresult.movieIDforC;  
          //Check for banner image
          var arrLoc =this._movieresult.movieBannerPathforC.split('/'); 
          if(arrLoc[arrLoc.length -1] == "")
          {
            $get('movieinfo', this.get_element()).innerHTML = "<span class='ptMovieNameClientWithoutBanner'>" + this._movieresult.movieNameforC + "</span>" + "<span class='ptSynopsisClient'>" + this._movieresult.movieSynopsisforC + "</span>";        
          }    
          else{
            $get('movieinfo', this.get_element()).innerHTML = "<img src=" + "'" +this._movieresult.movieBannerPathforC+ "'" + "class=" + "'" + "ptMovieBannerClient" + "'" + ">" + "<span class='ptMovieNameClient'>" + this._movieresult.movieNameforC + "</span>" + "<span class='ptSynopsisClient'>" + this._movieresult.movieSynopsisforC + "</span>";        
          }
          if(this._movieresult.movieOffWebSiteforC != "")
          {
			  $get('movieofficialwebsite', this.get_element()).innerHTML = "<a class='ptLink' href=" + "'" + this._movieresult.movieOffWebSiteforC + "'" + "target='_blank'" + "onclick=" +'"' + "LogClient('223', 'portalmain');" + '"' + "  >"+strClientMovieFeatured_OffSite+"</a>";       
          }
          if(this._movieresult.movieTrailerforC != "")
          {
              $get('movietrailer', this.get_element()).innerHTML = "<a class='ptLink' href=" + "'" + this._movieresult.movieTrailerforC + "'" + "target='_blank'" + "onclick=" +'"' + "LogClient('222', 'portalmain');" + '"' + " >"+strClientMovieFeatured_Trailer+"</a>";       
          }   
          $get('theatershowing', this.get_element()).innerHTML = "<div class='hline'/>";
          $get('findshowitme', this.get_element()).innerHTML = "<span class='ptMovieFind'>"+strClientMovieFeatured_LocalTimes+"</span>" + "<div class='ptMovieCity'>"+strClientMovieFeatured_EnterCode+"</div>" + "<input class='ptFrmText' id='featuredMovieinputzipcode' type='text' maxlength='30'>" + "<input id='featuredMoviesubmit' type='button' class='ptFrmButton' value='GO'> <div style='display:none; color:Red' id='errmsg' class='error'> </div>"; 
          
          if (this._buttonClickDelegate === null) 
          {
            this._buttonClickDelegate = Function.createDelegate(this, this.buttonClickDelegateHandler);
          }
          $addHandler($get('featuredMoviesubmit',this.get_element()),'click',this._buttonClickDelegate);
          
          if (this._keyPressDelegate === null) 
          {
            this._keyPressDelegate = Function.createDelegate(this, this.keyPressDelegateHandler);
          }
          $addHandler($get('featuredMovieinputzipcode',this.get_element()),'keypress',this._keyPressDelegate);
          

    },
    _clearComponents: function()
    {
        for(var a in this._components)
        {
            delete this._components[a];
        }
    },
    
    addComponent:function(e)
    {
        if(Sys.Component.isInstanceOfType(e))
            this._components[e.get_id()] = e;
    },
    getComponents:function()
    { 
        var a=[];b= this._components;
        for(var c in b)
        {
            a[a.length] = b[c];
        }
        return a;
    },
    findComponent:function(id)
    {
        return this._components[id];
    },
    removeComponent:function(b)
    {
        var a = b.get_id();
        if(a){delete this._components[a];}
    }
}

Insp.UI.ClientMovie.registerClass('Insp.UI.ClientMovie',Insp.UI.ModuleContentCtl,Sys.IContainer);

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
Type.registerNamespace("Insp");
Type.registerNamespace("Insp.UI");

Insp.UI.Widget = function(element)
{
    Insp.UI.Widget.initializeBase(this,[element]);
    this._url="";
    this._jsPrototype="";
    
    this._callbackDelegate = null;
    this._errorDelegate = null;
    this._jsExecDelegate = null;
}

Insp.UI.Widget.prototype = {
    get_url: function(){return this._url;},
    set_url: function(value){this._url = value;this.raisePropertyChanged('url');},
    
    get_jsPrototype: function(){return this._jsPrototype;},
    set_jsPrototype: function(value){this._jsPrototype = value;this.raisePropertyChanged('jsPrototype');},

    dispose: function()
    {
        if (this._callbackDelegate)delete this._callbackDelegate;
        if (this._errorDelegate)delete this._errorDelegate;
        if (this._jsExecDelegate)delete this._jsExecDelegate;
		Insp.UI.Widget.callBaseMethod(this,'dispose');
    },
    initialize: function()
    {
        Insp.UI.Widget.callBaseMethod(this,'initialize');
		this.addCssClass("ptModWidgt");
		this.addCssClass("moduleloading");
	
    	if (this._callbackDelegate === null) {
            this._callbackDelegate = Function.createDelegate(this, this.callbackHandler);
        }
        if (this._errorDelegate === null) {
            this._errorDelegate = Function.createDelegate(this, this._errorHandler);
        }
    	if (this._jsExecDelegate === null) {
            this._jsExecDelegate = Function.createDelegate(this, this._jsExecHandler);
        }
    },
    updated: function()
    {
        Portal.WidgetSvc.a(this.get_url(),this._callbackDelegate);
        Insp.UI.Widget.callBaseMethod(this,'updated');
    },
    callbackHandler: function(results)
    {
		if(results !== '')
		{
			this.removeCssClass("moduleloading");
			this.get_element().innerHTML = results;
			var d = this.get_element().getElementsByTagName("script");
			var t=d.length;
			for (var i=0;i<t;i++){
				var newScript = document.createElement('script');
				newScript.type = "text/javascript";
				newScript.text = d[i].text;
				if (d[i].src != '')
					newScript.src = d[i].src;
				this.get_element().appendChild (newScript);
			}
	        
			if(this.get_jsPrototype().length > 0)
			{
				window.setTimeout(this._jsExecDelegate,1000);
			}
		}else
			this._errorHandler();
    },
    _errorHandler: function(results)
    {
		this.removeCssClass("moduleloading");
		this.get_element().innerHTML = "<div style='margin:0;padding:1em 0;text-align:center;' class='feedErrorMessage'>"+widgetErrStr+"</div>";
    },
    _jsExecHandler: function()
    {
        obj = eval(this.get_jsPrototype());
        if(obj)obj.Execute(this.get_element());
    }
}
Insp.UI.Widget.registerClass('Insp.UI.Widget',Insp.UI.ModuleContentCtl);

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
